Created
January 30, 2019 09:33
-
-
Save ThaddeusJiang/5baf715aaf8e7c5abee9fb8b1fa553ec to your computer and use it in GitHub Desktop.
storybook with intl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { IntlProvider } from 'react-intl'; | |
import { translationMessages } from 'i18n'; | |
/* eslint-disable import/no-extraneous-dependencies */ | |
import { storiesOf } from '@storybook/react'; | |
import MyComponent from './index'; | |
storiesOf('MyComponent', module) | |
.add('en', () => ( | |
<IntlProvider locale="en" messages={translationMessages.en} textComponent={React.Fragment}> | |
<MyComponent value={1} /> | |
</IntlProvider> | |
)) | |
.add('ja', () => ( | |
<IntlProvider locale="ja" messages={translationMessages.ja} textComponent={React.Fragment}> | |
<MyComponent value={1} /> | |
</IntlProvider> | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment