⬆️(react) upgrade storybook to 8.4.x
With the latest version of storybook, our documentation were broken as we were trying to access to a property from an object that does not exist anymore. In fact, in the preview context, a property `globals` has been renamed `userGlobals`.
This commit is contained in:
committed by
Jean-Baptiste PENRATH
parent
86815cf95b
commit
0f6a8dfa72
@@ -5,10 +5,10 @@ import { Preview } from '@storybook/react';
|
|||||||
import { DocsContainer } from '@storybook/blocks';
|
import { DocsContainer } from '@storybook/blocks';
|
||||||
|
|
||||||
import { CunninghamProvider } from ':/components/Provider';
|
import { CunninghamProvider } from ':/components/Provider';
|
||||||
import { BACKGROUND_COLOR_TO_THEME, getThemeFromGlobals, themes } from './themes';
|
import {BACKGROUND_COLOR_TO_THEME, getThemeFromGlobals, Themes, themes} from './themes';
|
||||||
|
|
||||||
export const DocsWithTheme = (props, context) => {
|
export const DocsWithTheme = (props, context) => {
|
||||||
const theme = getThemeFromGlobals(props.context.store.globals.globals);
|
const theme = getThemeFromGlobals(props.context.store.userGlobals.globals);
|
||||||
return <CunninghamProvider theme={theme}>
|
return <CunninghamProvider theme={theme}>
|
||||||
<DocsContainer {...props} theme={themes[theme]} />
|
<DocsContainer {...props} theme={themes[theme]} />
|
||||||
</CunninghamProvider>;
|
</CunninghamProvider>;
|
||||||
@@ -23,7 +23,6 @@ const preview: Preview = {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
parameters: {
|
parameters: {
|
||||||
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
||||||
backgrounds: {
|
backgrounds: {
|
||||||
default: null,
|
default: null,
|
||||||
values: Object.entries(BACKGROUND_COLOR_TO_THEME).map(value => ({
|
values: Object.entries(BACKGROUND_COLOR_TO_THEME).map(value => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user