1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 02:58:09 +01:00
metamask-extension/.storybook/preview.js

47 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-05-03 19:51:15 +02:00
import React from 'react'
import { addDecorator, addParameters } from '@storybook/react'
2018-05-03 19:51:15 +02:00
import { withKnobs } from '@storybook/addon-knobs/react'
import { I18nProvider, LegacyI18nProvider } from '../ui/app/contexts/i18n'
import { Provider } from 'react-redux'
import configureStore from '../ui/app/store/store'
import '../ui/app/css/index.scss'
import en from '../app/_locales/en/messages'
2018-05-03 19:51:15 +02:00
addParameters({
backgrounds: [
{ name: 'light', value: '#FFFFFF'},
{ name: 'dark', value: '#333333' },
],
})
2018-05-03 19:51:15 +02:00
const styles = {
height: '100vh',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}
const store = configureStore({
metamask: { metamask: { currentLocale: 'en' } },
localeMessages: {
current: en,
en: en,
},
})
const metamaskDecorator = story => (
<Provider store={store}>
<I18nProvider>
<LegacyI18nProvider>
<div style={styles}>
{ story() }
</div>
</LegacyI18nProvider>
</I18nProvider>
</Provider>
2018-05-03 19:51:15 +02:00
)
addDecorator(withKnobs)
addDecorator(metamaskDecorator)