1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-30 13:50:05 +02:00

Add injectGlobal to storybook config to fix fonts and wrap all components in base component

This commit is contained in:
JUDIT GRESKOVITS 2017-02-08 14:53:37 +00:00
parent 1f2f8a6965
commit 0813b5c9fb

View File

@ -1,6 +1,35 @@
const { configure } = require('@kadira/storybook');
const React = require('react');
const { configure, addDecorator } = require('@kadira/storybook');
const req = require.context('../src/components', true, /story.js$/)
const req = require.context('../src/components', true, /story.js$/);
const Styled = require('styled-components');
const Base = require('../src/components/base');
const {
injectGlobal
} = Styled;
class StyledDecorator extends React.Component {
componentWillMount() {
injectGlobal`
${Base.global}
`;
}
render() {
return (
<Base>
{this.props.children}
</Base>
)
}
}
addDecorator((story) => (
<StyledDecorator>
{story()}
</StyledDecorator>
));
function loadStories() {
let stories = req.keys();