-
Notifications
You must be signed in to change notification settings - Fork 0
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
Reconsider Design System #12
Comments
Option 1: Styled Components Theme & Design TokensThis option would result in two big changes: Instead of using CSS Variables as the source of truth for customization, the source of truth is Styled Components Theme. The them would contain a set of design tokens (specifying color, sizing, typography, etc...) that components would then use to style themselves. Each component would expose a set of "style" props that let you configure things like margins / padding/ colors, etc... This would be the main way in which you tweak the presentation of components. They would still of course expose a className and style prop, for more-direct customization, but the idea would be that it keeps you more "on-rails" so to AdvantagesThis system would help resolve the above issues thusly:
Exampleimport { Button, ThemeProvider, design } from "@atomicjolt/atomic-elements";
const myTheme = design.theme.merge(
design.themes.elementsTheme, // The default theme
{
"colors.primary": "#ff0000", // Override a token for the app
}
)
function MyApp() {
// "size.2000" refers to a token in the theme.
return (
<ThemeProvider value={myTheme}>
<Button $paddingLeft="size.2000">
Press Me
</Button>
</ThemeProvider>
)
} Backwards CompatibilityTo make migrating straightforward, we can provide a default theme in elements whose values all reference the pre-existing CSS variables. That way, you can use that theme and it should mostly be a "drop-in" replacement. |
Option 2: Styled-System (Chakra UI) |
Since I'm moving towards a Elements 3.0 release, I'd also like to consider rethinking the design system that we currently use based on CSS variables
Motivation
The current system has a good chunk of disadvantages:
The text was updated successfully, but these errors were encountered: