aboutsummaryrefslogtreecommitdiffstats
path: root/.storybook/preview.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-19 15:47:08 +0200
committerArmand Philippot <git@armandphilippot.com>2023-09-19 19:16:58 +0200
commit03331c44276ec56e9f235e4d5ee75030455a753f (patch)
treeb9248a7db3090e02bf38fe573f2ea973ed8a1561 /.storybook/preview.js
parent2faf2e34331703b3bdea3eb487cb8799c8d65377 (diff)
build(deps): bump all dependencies
* MDX type has changed so some components props had to be updated * Since Storybook now supports TS, I renamed the main/preview files
Diffstat (limited to '.storybook/preview.js')
-rw-r--r--.storybook/preview.js56
1 files changed, 0 insertions, 56 deletions
diff --git a/.storybook/preview.js b/.storybook/preview.js
deleted file mode 100644
index ce30b56..0000000
--- a/.storybook/preview.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import { ThemeProvider, useTheme } from 'next-themes';
-import { useEffect } from 'react';
-import { IntlProvider } from 'react-intl';
-import { useDarkMode } from 'storybook-dark-mode';
-import { DocsContainer } from './overrides/docs-container';
-import dark from './themes/dark';
-import light from './themes/light';
-import '../src/styles/globals.scss';
-
-export const parameters = {
- actions: { argTypesRegex: '^on[A-Z].*' },
- controls: {
- matchers: {
- color: /(background|color)$/i,
- date: /Date$/,
- },
- },
- darkMode: {
- // Override the default dark theme
- dark: { ...dark },
- // Override the default light theme
- light: { ...light },
- stylePreview: true,
- },
- docs: {
- container: DocsContainer,
- },
-};
-
-// Create a component that listens for theme change.
-export const ThemeWrapper = (props) => {
- const { setTheme } = useTheme();
- const theme = useDarkMode() ? 'dark' : 'light';
-
- useEffect(() => {
- setTheme(theme);
- }, [theme, setTheme]);
-
- return <>{props.children}</>;
-};
-
-export const decorators = [
- (Story) => (
- <IntlProvider locale="en">
- <ThemeProvider
- defaultTheme="system"
- enableColorScheme={true}
- enableSystem={true}
- >
- <ThemeWrapper>
- <Story />
- </ThemeWrapper>
- </ThemeProvider>
- </IntlProvider>
- ),
-];