mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Update migration guide and refactor portable stories to use initialGlobals for locale configuration instead of globalTypes defaultValue.
This commit is contained in:
parent
3dcc104933
commit
1750457a1e
22
MIGRATION.md
22
MIGRATION.md
@ -470,7 +470,27 @@ export const preview = {
|
||||
};
|
||||
```
|
||||
|
||||
Additionally loading `globals` from globalTypes isn't supported in portable stories anymore. Use `initialGlobals` instead.
|
||||
Additionally loading the defaultValue from `globalTypes` isn't supported anymore. Use `initialGlobals` instead to define the defaultValue.
|
||||
|
||||
```diff
|
||||
// .storybook/preview.js
|
||||
export default {
|
||||
+ initialGlobals: {
|
||||
+ locale: 'en'
|
||||
+ },
|
||||
globalTypes: {
|
||||
locale: {
|
||||
description: 'Locale for components',
|
||||
- defaultValue: 'en',
|
||||
toolbar: {
|
||||
title: 'Locale',
|
||||
icon: 'circlehollow',
|
||||
items: ['es', 'en'],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### Icon System Updates
|
||||
|
||||
|
@ -12,10 +12,12 @@ const preview: Preview = {
|
||||
</div>
|
||||
),
|
||||
],
|
||||
initialGlobals: {
|
||||
locale: 'en',
|
||||
},
|
||||
globalTypes: {
|
||||
locale: {
|
||||
description: 'Locale for components',
|
||||
defaultValue: 'en',
|
||||
toolbar: {
|
||||
title: 'Locale',
|
||||
icon: 'circlehollow',
|
||||
|
@ -55,7 +55,7 @@ describe('projectAnnotations', () => {
|
||||
|
||||
it('renders with custom projectAnnotations via composeStory params', () => {
|
||||
const WithPortugueseText = composeStory(stories.CSF2StoryWithLocale, stories.default, {
|
||||
globalTypes: { locale: { defaultValue: 'pt' } },
|
||||
initialGlobals: { locale: 'pt' },
|
||||
});
|
||||
const { getByText } = render(<WithPortugueseText />);
|
||||
const buttonElement = getByText('Olá!');
|
||||
|
Loading…
x
Reference in New Issue
Block a user