-
Notifications
You must be signed in to change notification settings - Fork 5
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
Design system #88
Comments
In their documentation that use styled components. In their code sandbox for emotion they use Perhaps we should revisit the conversation around using styled components. Using styled components is my preference, rather than css objects assigned from the css prop |
from https://styled-system.com/how-it-works ;) :
honestly, neither the object approach nor styled components should be limiting. a big part of the object approach for me is that it just lends itself more easily in my mind for importing from other files and manipulation with js. for example, we haven't really used it here yet, but i've found polished to be really helpful to bring a bunch of the sass functionality to css-in-js and it just seems like a more natural fit for use with the object approach to me. i'm sure it could work with styled as well, but i just have a harder time getting my head around that way. is there a big roadblock that youre seeing with the object approach, or mostly the overhead of trying to learn both? |
We seem to be having a misunderstanding. Originally, it sounded like In the example I install The current approach of assigning css with the |
i think this might be part of where i'm not explaining myself very well. my goal is to avoid the extra DOM element that is only being added to enable styling, whether that is a instead, i'd like to style the ones that already have to exist because they have semantic meaning. in this case, we already have a DOM element that acts as a container for the icon and text, the as far as the open question goes, i think i've convinced myself through the
with the explanation above, would you still see value in having both approaches used? i see value to having a consistent single way to apply styles, but could be missing part of what youre trying to show. if the options are between passing an object to the
while the implementation starts out that way, its not how the library applies the styles, so it doesnt come with the downsides. as we've already shown, though, the rules can easily be pulled out to a variable or even a separate file. the links are already an example of needing to do that in order to share the same rules across multiple components. whether the rules are defined inline in the jsx is an implementation detail in my mind, but the flexibility to pull out further and further is a strong benefit, imho. |
for a little background on my preference of using minimal, semantic-markup, the idea of divitis highlights a big part of what im trying to communicate. once you eliminate extra DOM elements that are only there for style, i think the difference between the css prop on a real DOM element vs a styled component is just implementation details for the same outcome. if that's the case, having two ways to do the same thing seems like just asking for confusion from new contributors |
It sounds like the answers here come down to a combination of philosophy and principle. You are probably correct that each approach on it's own is valid and can achieve desired goals. I like the push to minimize the amount of extra elements on the DOM. Also, ease of contribution for a newcomer is a great focus. How to accomplish this though, is a great question. From what I've seen, styled components allows you to organize and reuse your components in such a way that it reduces the amount of noise in the dom, including extra elements. To replace a As far as a newcomer coming in, having to adhere to one approach might be more challenging or confusing. I understand the consistency within the codebase argument. I think the styled components approach creates a cleaner separation of styles and element arrangement (rather than inline styles via props) that yields a more readable and easier approach to the codebase. I'm keen on learning a variety of approaches, including the one you are advocating for here. Maybe it is just a difference in approach in the end - no real benefits with either approach. I don't know if I have experienced enough to really say that, but the example you are giving here in this issue does support the use of styled components. |
i think this is the unfortunate state of styling with react at this point. there are many choices out there between raw css, css-modules, sass with css-modules, before even getting into the css-in-js options. it does come with a need for a bit of hand-holding with newcomers, but i think that is part of being a welcoming project anyway. i'm already planning to capture some of the decisions that have been made as i catch up on some more of the contribution docs, so im hoping that will help some too.
since this thread has gotten pretty distracted from the original issue, we should probably either open a new design system ticket and rename this one or move further conversation to somewhere like slack. i'm more than happy to keep discussing and am always option to learning pieces that i may be overlooking/misunderstanding. it does seem to me like two options of accomplishing the same goal, but i dont want my understanding to shut down the conversation or make it harder for you to continue contributing :). |
Cool. I agree - let's table the discussion for now. Maybe we can also get folks to weigh in who have more experience on the future of the design system for the site (or just wait until the potential redesign to do that and just continue forging forward with your plan) |
https://github.com/jxnblk/styled-system
The text was updated successfully, but these errors were encountered: