2018-03-29 09:05:42 +00:00
|
|
|
import 'babel-polyfill'
|
2018-03-15 10:14:20 +00:00
|
|
|
import { addDecorator, configure } from '@storybook/react'
|
|
|
|
import { withKnobs } from '@storybook/addon-knobs'
|
2018-07-16 14:52:27 +00:00
|
|
|
import { MuiThemeProvider } from '@material-ui/core/styles'
|
2018-03-15 10:14:20 +00:00
|
|
|
import * as React from 'react'
|
2018-03-29 09:52:58 +00:00
|
|
|
import { Provider } from 'react-redux'
|
2018-03-15 10:14:20 +00:00
|
|
|
import StoryRouter from 'storybook-router'
|
2018-03-29 09:52:58 +00:00
|
|
|
import { store } from '~/store'
|
2018-03-29 09:05:42 +00:00
|
|
|
import theme from '~/theme/mui'
|
|
|
|
import 'index.scss'
|
2018-03-15 10:14:20 +00:00
|
|
|
|
|
|
|
(function (global) {
|
|
|
|
//Useful for adding data and libraries to window object.
|
|
|
|
})(typeof window !== 'undefined' ? window : {});
|
|
|
|
|
|
|
|
addDecorator(withKnobs);
|
|
|
|
addDecorator(StoryRouter())
|
|
|
|
|
2018-03-29 09:52:58 +00:00
|
|
|
addDecorator((story) => (
|
|
|
|
<Provider store={store}>
|
|
|
|
<MuiThemeProvider theme={theme}>
|
|
|
|
{ story() }
|
|
|
|
</MuiThemeProvider>
|
|
|
|
</Provider>
|
2018-03-29 09:05:42 +00:00
|
|
|
))
|
|
|
|
|
2018-03-15 10:14:20 +00:00
|
|
|
const components = require.context('../src/components', true, /\.stories\.((js|ts)x?)$/)
|
|
|
|
const routes = require.context('../src/routes', true, /\.stories\.((js|ts)x?)$/)
|
|
|
|
|
|
|
|
function loadStories() {
|
|
|
|
components.keys().forEach((filename) => components(filename))
|
|
|
|
routes.keys().forEach((filename) => routes(filename))
|
|
|
|
}
|
|
|
|
|
2018-03-29 09:52:58 +00:00
|
|
|
configure(loadStories, module)
|