Skip to content

Commit

Permalink
feat: change to storybook 8.2 initialGlobals
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensacks committed Jul 29, 2024
1 parent 82b72c6 commit 5f001a8
Show file tree
Hide file tree
Showing 4 changed files with 4,032 additions and 5,196 deletions.
2 changes: 1 addition & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {Preview} from '@storybook/react';
import {reactIntl} from './reactIntl';

const preview: Preview = {
globals: {
initialGlobals: {
locale: 'en',
locales: {
en: {icon: '🇺🇸', title: 'English', right: 'EN'},
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Add react-intl support to Storybook.

Required Versions:

v3.1.x
* storybook - `^8.2.0`
* react-intl - `^5.24.0 || ^6.0.0`

v3.0.x
* storybook - `^8.0.0`
* react-intl - `^5.24.0 || ^6.0.0`

Expand Down Expand Up @@ -69,7 +75,7 @@ export const reactIntl = {
---

### preview.ts
In your `preview.ts`, you need to add the `locales` and `locale` to `initialGlobals` (or `globals` if you're not using the latest version of storybook), as well as add `reactIntl` that you exported from the above file to parameters.
In your `preview.ts`, you need to add the `locales` and `locale` to `initialGlobals` (or `globals` if you're not using storybook 8.2+), as well as add `reactIntl` that you exported from the above file to parameters.

`locales` is an object where the keys are the "ids" of the locales/languages and the values are the names you want to display in the dropdown.

Expand Down
Loading

0 comments on commit 5f001a8

Please sign in to comment.