Hacker News new | ask | show | jobs
by onion2k 878 days ago
Styled components are code. You could easily have a value from a central config rather than a string, like ${company.padding.px}.
2 comments

Sure. But now you need to maintain both places, you must think of units, and all the edge cases the Tailwind code base already handles.
What you're talking about is really a theming design system, which yes Tailwind does have out of the box and Styled Components does not. But the companies I work in always have their own in-house design system, which means you have to maintain it yourself no matter what.
hey no need to make this an hypothetical! styled components come with ThemeProvider that does just that.

  const StyledButton = styled.button`
    background-color: ${props => props.theme.primaryColor};
  `