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-03-29 09:05:42 +00:00
|
|
|
import { MuiThemeProvider } from 'material-ui/styles'
|
2018-03-15 10:14:20 +00:00
|
|
|
import * as React from 'react'
|
|
|
|
import StoryRouter from 'storybook-router'
|
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:05:42 +00:00
|
|
|
// Adding Material UI Theme
|
|
|
|
addDecorator(story => (
|
|
|
|
<MuiThemeProvider theme={theme}>
|
|
|
|
{ story() }
|
|
|
|
</MuiThemeProvider>
|
|
|
|
))
|
|
|
|
|
|
|
|
/*
|
|
|
|
https://storybook.js.org/addons/introduction/
|
|
|
|
addDecorator((story) => (
|
2018-03-15 10:14:20 +00:00
|
|
|
<div>
|
|
|
|
{ story() }
|
|
|
|
</div>
|
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))
|
|
|
|
}
|
|
|
|
|
|
|
|
configure(loadStories, module);
|