mirror of
https://github.com/yldio/copilot.git
synced 2024-12-01 07:30:07 +02:00
Merge pull request #236 from yldio/fix/ui-correct-fonts
Add injectGlobal to storybook config to fix fonts and wrap all compon…
This commit is contained in:
commit
9c785150ba
@ -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() {
|
function loadStories() {
|
||||||
let stories = req.keys();
|
let stories = req.keys();
|
||||||
|
Loading…
Reference in New Issue
Block a user