Browse Source

Wrap stories with ThemeProvider and inject global style in them

master
meriadec 7 years ago
parent
commit
7582545ca5
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 13
      .storybook/config.js

13
.storybook/config.js

@ -1,8 +1,19 @@
import { configure } from '@storybook/react'
import React from 'react'
import { configure, addDecorator } from '@storybook/react'
import { ThemeProvider } from 'styled-components'
import 'styles/global'
import theme from 'styles/theme'
const req = require.context('../src', true, /.stories.js$/)
function loadStories() {
req.keys().forEach(filename => req(filename))
}
addDecorator(story => (
<ThemeProvider theme={theme}>
<div style={{ padding: 20 }}>{story()}</div>
</ThemeProvider>
))
configure(loadStories, module)

Loading…
Cancel
Save