UNPKG

1.01 kBJavaScriptView Raw
1import React from 'react'
2import { configure, addDecorator } from '@storybook/react'
3// import { withInfo } from '@storybook/addon-info'
4import { setIntlConfig, withIntl } from 'storybook-addon-intl'
5// import { withPropsTable } from 'storybook-addon-react-docgen'
6
7const translations = {
8 ReportView: {
9 en: require('../translations/en.json'),
10 es: require('../translations/es.json'),
11 fr: require('../translations/fr.json')
12 }
13}
14
15const getMessages = locale => {
16 return {
17 ...translations.ReportView[locale]
18 }
19}
20
21// Set intl configuration
22setIntlConfig({
23 locales: ['en', 'es', 'fr'],
24 defaultLocale: 'en',
25 textComponent: React.Fragment,
26 getMessages
27})
28
29// Register decorator
30// addDecorator(withPropsTable)
31addDecorator(withIntl)
32
33// addDecorator((story, context) =>
34// withInfo({
35// header: false,
36// inline: true
37// })(story)(context)
38// )
39
40// automatically import all files ending in *.stories.js
41configure(require.context('../src', true, /\.stories\.js$/), module)