Skip to content

Commit

Permalink
Merge pull request #11 from stevensacks/feat/sb8
Browse files Browse the repository at this point in the history
feat: storybook 8 support
  • Loading branch information
stevensacks authored Mar 6, 2024
2 parents f1719f8 + 01fddb4 commit 77749f2
Show file tree
Hide file tree
Showing 11 changed files with 4,378 additions and 4,557 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ build-storybook.log
.DS_Store
.env
.idea
.yarn
.npmrc
4 changes: 2 additions & 2 deletions .storybook/local-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* to load the built addon in this test Storybook
*/
function previewAnnotations(entry = []) {
return [...entry, require.resolve("../dist/preview.mjs")];
return [...entry, require.resolve('../dist/preview.js')];
}

function managerEntries(entry = []) {
return [...entry, require.resolve("../dist/manager.mjs")];
return [...entry, require.resolve('../dist/manager.js')];
}

module.exports = {
Expand Down
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`.
2 changes: 1 addition & 1 deletion manager.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/manager';
import './dist/manager';
Loading

0 comments on commit 77749f2

Please sign in to comment.