Injecting components for advanced themingDecember 20, 2017 at 5:26pm
Does it make sense for a component to take not just styles from a theme but full styled components? For example https://gitlab.coko.foundation/tamlyn/theming/blob/master/injected-ui/src/TextInput/TextInput.js
I'm working on an open source suite of React components (https://pubsweet.org) which will be used by different organisations and needs to fit in with their branding. Theme variables for fonts, colours, spacing etc. will get us most of the way there but it's likely implementers will need to make changes which we don't have a variable for.
React CSS Themr is a good fit for this but has some issues as discussed here https://github.com/react-toolbox/react-toolbox/blob/dev/ROADMAP.md#where-is-this-project-going
December 20, 2017 at 7:07pm
So yeah, you're definitely on a good road
December 21, 2017 at 10:49am
January 4, 2018 at 10:03am
Thanks for the link. Yeah that video explains it well. His implementation is very similar though he uses factory functions to create components with the styled components injected, whereas I am using the context to pass down the styled components.
His approach works well for atoms and molecules but gets complex for organism level components which I need to support. One issue with my approach is you need a consistent naming convention to address each component from the theme.