-
Notifications
You must be signed in to change notification settings - Fork 19
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
How to map theme to properties #10
Comments
If I understand correctly, you want to map CSS Properties to their respective theme scale. If that's the case, you can use Styled System's CSS function |
Not too sure if we understood one another 😆but let me explain again. Let me start by saying that my question is not a technical but rather more of an architectural one. I am assuming that one of the advantages of having a theme specification is to have interchangeable themes. For themes to be interchangeable, different theme designers should have a common understanding of which type of components are affected with certain values. For example, assume a situation where a I guess what I am saying is that there seems to be a missing part to this spec (i.e. how the theme values get mapped to components). @peduarte hope that made sense. What's your opinion on this? |
Ah, I got you. It's an excellent question, and as you said, it's more of an architectural one. I'm not totally sure what's the best way to achieve this without spending a few days thinking about the problem and prototyping ideas. At a glance, this doesn't feel like a problem to me, it's more of a change in mindset. As a designer creating a new theme, I don't think I'd care that I am really curious how you'll approach it, please share your progress 🙂 |
@peduarte I was giving this some thought and I have come up with 2 possible solutions.
I like the second option as it seems to be more flexible. @peduarte what are your thoughts on this? |
FWIW/ICYMI this spec hasn't been updated in a while, but I've written about some of the concepts around it here: https://jxnblk.com/blog/design-graph/ -- I think the concepts of scales and variants are particularly relevant to the conversation happening here |
@jxnblk I like what you have done. Your graph solution is pretty much a version of the abstraction layer that I am talking about. I agree, scales and variants are very much important. I can see how people can argue that this may be tedious, but I think being explicit about the mapping advantageously explicit. |
Thank you for this spec. I have been working on a side project that utilizes a theme with a shape similar to that in this spec. The one challenge I have is determining a systemic way to map values from the theme to styles in my React component library. I unfortunately do a lot of guess work. This is especially true when using values that are part of an array field (ex.
sizes
,space
, etc).Do you think it would beneficial to be more explicit about what each value in the array index would map to? For example, do you think we can benefit from saying something like
theme.space[2]
will map to things like button paddings?The main reason I bring this up is because I'm assuming that my guesswork really beats the point behind using this theme spec. It would be unfortunate if someone was designing a spec but the components did not map them in the way they had in mind.
The text was updated successfully, but these errors were encountered: