aboutsummaryrefslogtreecommitdiffstats
path: root/.storybook/preview.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-27 18:07:45 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:15:27 +0100
commit05f1dfc6896d3affa7c494a1b955f230d836a4b7 (patch)
tree3089d5c3145f241293b88b9a1bfe4bb85e8ca9e0 /.storybook/preview.tsx
parent757201fdc5c04a3f15504f74bf8ab85bb6018c2b (diff)
feat: replace next-themes with a custom ThemeProvider
To be honest, next-themes was working fine. However since I use a theme provider for Prism code blocks, some code is duplicated between this app and the library. So I prefer to use a custom Provider without the options I don't need.
Diffstat (limited to '.storybook/preview.tsx')
-rw-r--r--.storybook/preview.tsx14
1 files changed, 7 insertions, 7 deletions
diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
index f3f374f..d5cc8cc 100644
--- a/.storybook/preview.tsx
+++ b/.storybook/preview.tsx
@@ -1,13 +1,17 @@
import type { Decorator, Preview } from '@storybook/react';
-import { ThemeProvider, useTheme } from 'next-themes';
import { useDarkMode } from 'storybook-dark-mode';
import { FC, ReactNode, useEffect } from 'react';
import { IntlProvider } from 'react-intl';
-import { AckeeProvider, MotionProvider } from '../src/utils/providers';
+import {
+ AckeeProvider,
+ MotionProvider,
+ ThemeProvider,
+} from '../src/utils/providers';
import '../src/styles/globals.scss';
import { DocsContainer } from './overrides/docs-container';
import dark from './themes/dark';
import light from './themes/light';
+import { useTheme } from '../src/utils/hooks';
type ThemeWrapperProps = {
children: ReactNode;
@@ -28,11 +32,7 @@ export const ThemeWrapper: FC<ThemeWrapperProps> = ({ children }) => {
const withAllProviders: Decorator = (Story) => {
return (
<IntlProvider locale="en">
- <ThemeProvider
- defaultTheme="system"
- enableColorScheme={true}
- enableSystem={true}
- >
+ <ThemeProvider attribute="theme" storageKey="theme">
<MotionProvider attribute="reduced-motion" storageKey="reduced-motion">
<AckeeProvider
domainId="any"