So that the users of ui-components don't have to do it themselves by installing styled-components in their client app, importing our theme and passing it to the <ThemeProvider /> wrapper - those should be the internals that the user of our components shouldn't have to think about - besides, it arguably goes against atomic components principles.
How?
We could create a HOC wrapper withThemeProvider that we could use on all our components - it could take the optional theme as a component param that it would pass along to the component, which would enable our components to be used with different themes. If no theme prop is provided, we could default to the current theme.
Why?
So that the users of
ui-components
don't have to do it themselves by installingstyled-components
in their client app, importing our theme and passing it to the<ThemeProvider />
wrapper - those should be the internals that the user of our components shouldn't have to think about - besides, it arguably goes against atomic components principles.How?
We could create a HOC wrapper
withThemeProvider
that we could use on all our components - it could take the optionaltheme
as a component param that it would pass along to the component, which would enable our components to be used with different themes. If notheme
prop is provided, we could default to the current theme.Potential downsides
Motivated by #411.
cc @foot @guyfedwards