Discovery findings: using styled-components #2196
zarahzachz
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I did some discovery in replacing our current styles solution (node-sass) with a CSS-in-JS solution. Since the Storybook Design System guide recommended styled-components as their CSS-in-JS solution, I explored that.
Tl;dr I found it pretty annoying writing CSS-in-JS, which I'll detail more below.
Pros
Using our design tokens in our styles was fairly straight-forward
In theory, styles could be more simply written
There was baked-in support for nesting
Cons
Styles are tightly scoped to the component
Bad DX (I consider this more of a slight con)
Not all Sass features supported
&feature to quickly created variations of styles (for state purposes) wasn'tFolding styles into the component logic made file length a little unwieldily
Direction on ideal theming support is not entirely understood
Utility classes (and other shared CSS) can't be supported
Summary
I think if I were working on a non-design system project and didn't need to support multiple themes, styled-components would probably work. But given the complexity of our product, adopting styled-components at this time doesn't feel like a wise use of time/effort.
Beta Was this translation helpful? Give feedback.
All reactions