Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support textStyleId #77

Open
donfour opened this issue May 9, 2023 · 0 comments
Open

Support textStyleId #77

donfour opened this issue May 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@donfour
Copy link
Contributor

donfour commented May 9, 2023

Resources:

Thoughts:

  • Text styles are not much use in HTML + inline CSS
  • For JS + inline CSS, we can create an object variable from the text style, then use it whenever the text style needs to be applied to a node. For example:
const headerStyles = {
  fontSize: "24px",
  fontWeight: "800"
}
// inside the component...
<div style={{...headerStyles, /* other styles */}}>Title</div>
  • For JS/HTML + Tailwind CSS, there could be multiple approaches:
    1. (JS only) Similar to the inline CSS approach, we can create a string variable from the text style.
    const headerStyles = {
      fontSize: "24px",
      fontWeight: "800"
    }
    // inside the component...
    <div style={{...headerStyles, /* other styles */}}>Title</div>
    1. We could do nothing (following Tailwind's utility-first philosophy)
    2. (For both HTML & JS) Use @apply directive (also recommended by Tailwind)

I like the 3rd option, because if the designer has bothered to create text styles in Figma, they must be frequently used enough to justify it. Also it works across different UI and CSS frameworks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant