Skip to content

Commit

Permalink
Merge pull request #27 from stevensacks/feat/sb8
Browse files Browse the repository at this point in the history
feat: storybook 8
  • Loading branch information
stevensacks committed Mar 6, 2024
2 parents 34b0176 + 7fc0ef8 commit 865463f
Show file tree
Hide file tree
Showing 12 changed files with 3,957 additions and 4,228 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
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Easy react-i18next Storybook integration.

Required Peer Dependencies:
* storybook - `^7.0.0`
* storybook - `^8.0.0`
* i18next - `^22.0.0`
* i18next-browser-languagedetector - `^7.0.0`
* i18next-http-backend: `^2.0.0`
Expand Down Expand Up @@ -156,9 +156,9 @@ const preview: Preview = {
globals: {
locale: "en",
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 All @@ -175,12 +175,12 @@ import i18n from './i18next';

const preview: Preview = {
globals: {
locale: "en_US",
locale: 'en_US',
locales: {
en_US: {title: "English", right: 'US'},
en_GB: {title: "English", right: 'GB'},
fr_FR: {title: "Français", right: 'FR'},
ja_JP: {title: "日本語", right: 'JP'},
en_US: {title: 'English', right: 'US'},
en_GB: {title: 'English', right: 'GB'},
fr_FR: {title: 'Français', right: 'FR'},
ja_JP: {title: '日本語', right: 'JP'},
},
},
parameters: {
Expand Down Expand Up @@ -217,7 +217,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 in `parameters`.

Switching locales will use the strings defined in your locale json files.

## 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';

0 comments on commit 865463f

Please sign in to comment.