weaveworks / ui-components

A collection of UI components that are shared across Weaveworks projects
http://weaveworks-ui-components.s3-website-us-west-2.amazonaws.com/
Apache License 2.0
30 stars 26 forks source link

RFC: Wrap every exported component with its own theme provider #418

Open fbarl opened 5 years ago

fbarl commented 5 years ago

Why?

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.

Potential downsides

Motivated by #411.

cc @foot @guyfedwards