Closed sergeysova closed 6 years ago
jss-theme-reactor? the next version of material-ui will be using it.
jss-theme-reactor is more an internal tool for mui, for now its not stable enough to rely on it.
Unstable internal tool? It's mentioned high up on the JSS README
Making the ThemeProvider portable is already trivial. The rewiring to the component lib is a little annoying but easy peasy.
I just started to look at styled-jss and it's not looking so good there. I probably have to merge the context to the props in a hof/hoc. It should behave like styled-components/styletron imo.
ThemeProvider just needs to provide this:
ThemeProvider.contextTypes = {
theme: PropTypes.object,
styleManager: PropTypes.object,
}
styleManager
just goes to the jss-lib and theme
is read by the component directly:
styledComponent.button`
color: ${ (props, context) => props.color || context.theme.color.main || 'blue' };
`
styletron('button', (props, context) => {
color: props.color || context.theme.color.main || 'blue'
})
with hof:
styledComponent.button`
color: ${ fromTheme('color.main', 'blue') };
`
styletron('button', (props, context) => {
color: fromTheme('color.main', 'blue')
})
Yep, I probably added it too early.
The idea we work on is one ThemeProvider which will work with all libs, react-jss, styled-jss, styled-components etc etc
We are just not there yet, we still need to finalize it.
@iamstarkov is working on a ThemeProvider which will work with styled-jss and react-jss and many others.