Library user
After you distribute your library -- possibly to yourself, but not necessarily -- your library users need to set up the providers and theme:
Here is the full, verbose setup code. See the previous page for an example of how it can be simplified.
index.js
import {ThemeProvider} from 'amazing-component-library';
import {StyletronProvider} from 'styletron-react';
import Styletron from 'styletron-client';
// override theme & meta values. these, of course, are
// tied to your library, and whatever values you make
// overridable
//
const ourAppTheme = {
meta: {
colors: {
// I'm overriding your rotten colors
primary: '#54209a',
gray0: '#05000a',
gray6: '#55afa4'
},
Button: {
borderRadius: 0
}
// etc
}
};
render(
<ThemeProvider theme={ourAppTheme}>
<StyletronProvider styletron={new Styletron()}>
<Home />
</StyletronProvider>
</ThemeProvider>
, document.getElementById('app'));