From 0813b5c9fbc784e8671a0f9f2d85c99b075875a5 Mon Sep 17 00:00:00 2001 From: JUDIT GRESKOVITS Date: Wed, 8 Feb 2017 14:53:37 +0000 Subject: [PATCH] Add injectGlobal to storybook config to fix fonts and wrap all components in base component --- ui/.storybook/config.js | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/ui/.storybook/config.js b/ui/.storybook/config.js index bb888c3a..76294912 100644 --- a/ui/.storybook/config.js +++ b/ui/.storybook/config.js @@ -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 ( + + {this.props.children} + + ) + } +} + +addDecorator((story) => ( + + {story()} + +)); function loadStories() { let stories = req.keys();