Skip to content

Commit

Permalink
feat: storybook 8 compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensacks committed Mar 6, 2024
1 parent 2ee9ca4 commit 01fddb4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const preview: Preview = {
globals: {
locale: 'en',
locales: {
en: {title: 'English', left: '🇺🇸', right: 'EN'},
fr: {title: 'French', left: '🇫🇷', right: 'FR'},
ja: {title: '日本語', left: '🇯🇵', right: 'JA'},
en: {icon: '🇺🇸', title: 'English', right: 'EN'},
fr: {icon: '🇫🇷', title: 'Français', right: 'FR'},
ja: {icon: '🇯🇵', title: '日本語', right: 'JP'},
},
},
parameters: {
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Add react-intl support to Storybook.

Required Versions:
* storybook - `^7.0.0`
* storybook - `^8.0.0`
* react-intl - `^5.24.0 || ^6.0.0`

This Storybook addon assumes your project is already set up with [react-intl](https://formatjs.io/docs/react-intl/), and that it is properly configured and working.
Expand Down Expand Up @@ -103,9 +103,9 @@ const preview: Preview = {
globals: {
locale: reactIntl.defaultLocale,
locales: {
en: {title: "English", left: '🇺🇸'},
fr: {title: "Français", left: '🇫🇷'},
ja: {title: "日本語", left: '🇯🇵'},
en: {icon: '🇺🇸', title: 'English', right: 'EN'},
fr: {icon: '🇫🇷', title: 'Français', right: 'FR'},
ja: {icon: '🇯🇵', title: '日本語', right: 'JP'},
},
},
parameters: {
Expand Down Expand Up @@ -142,7 +142,3 @@ Once you have finished these steps and launch storybook, you should see a globe
Clicking this globe icon will show a dropdown with the locales you defined.

Switching locales will use the strings defined in your messages.

## Migrating to Storybook 7

In `.storybook/preview.ts`, move the locale/locales to be under `globals` instead of `parameters`.
19 changes: 7 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"name": "storybook-react-intl",
"version": "2.1.0",
"description": "Add react-intl support to Storybook",
Expand Down Expand Up @@ -51,7 +51,7 @@
"build-storybook": "storybook build"
},
"dependencies": {
"storybook-i18n": "../storybook-i18n"
"storybook-i18n": "^2.1.1"
},
"devDependencies": {
"@storybook/addon-essentials": "8.0.0-beta.2",
Expand Down

0 comments on commit 01fddb4

Please sign in to comment.