generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed886f8
commit 5375060
Showing
30 changed files
with
12,397 additions
and
12,407 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ build-storybook.log | |
.DS_Store | ||
.env | ||
.idea | ||
.yarn |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {initReactI18next} from 'react-i18next'; | ||
import i18n from 'i18next'; | ||
import Backend from 'i18next-http-backend'; | ||
import LanguageDetector from 'i18next-browser-languagedetector'; | ||
import en from '../src/stories/locales/en'; | ||
import fr from '../src/stories/locales/fr'; | ||
import ja from '../src/stories/locales/ja'; | ||
|
||
const languages: Record<string, any> = {en, fr, ja}; | ||
|
||
const ns = ['common']; | ||
const supportedLngs = ['en', 'fr', 'ja']; | ||
const resources = ns.reduce((acc, n) => { | ||
supportedLngs.forEach((lng) => { | ||
if (!acc[lng]) acc[lng] = {}; | ||
acc[lng] = { | ||
...acc[lng], | ||
[n]: languages[lng], | ||
}; | ||
}); | ||
return acc; | ||
}, {} as Record<string, any>); | ||
|
||
i18n.use(initReactI18next) | ||
.use(LanguageDetector) | ||
.use(Backend) | ||
.init({ | ||
//debug: true, | ||
lng: 'en', | ||
fallbackLng: 'en', | ||
defaultNS: 'common', | ||
ns, | ||
interpolation: {escapeValue: false}, | ||
react: {useSuspense: false}, | ||
supportedLngs, | ||
resources, | ||
}); | ||
|
||
export default i18n; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* to load the built addon in this test Storybook | ||
*/ | ||
function previewAnnotations(entry = []) { | ||
return [...entry, require.resolve("../dist/preview.mjs")]; | ||
} | ||
|
||
function managerEntries(entry = []) { | ||
return [...entry, require.resolve("../dist/manager.mjs")]; | ||
} | ||
|
||
module.exports = { | ||
managerEntries, | ||
previewAnnotations, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type {StorybookConfig} from '@storybook/react-vite'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
'storybook-i18n', | ||
'./local-preset.js', | ||
], | ||
framework: { | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script> | ||
window.global = window; | ||
</script> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type {Preview} from '@storybook/react'; | ||
// @ts-ignore | ||
import i18n from './i18next'; | ||
|
||
const preview: Preview = { | ||
globals: { | ||
locale: 'en', | ||
locales: { | ||
en: {title: 'English', left: '🇺🇸', right: 'EN'}, | ||
fr: {title: 'French', left: '🇫🇷', right: 'FR'}, | ||
ja: {title: '日本語', left: '🇯🇵', right: 'JA'}, | ||
}, | ||
}, | ||
parameters: { | ||
actions: {argTypesRegex: '^on[A-Z].*'}, | ||
backgrounds: { | ||
default: 'light', | ||
}, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
i18n, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './dist/manager'; |
Oops, something went wrong.