Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: install Storybook addon themes #5785

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const config: StorybookConfig = {
addons: [
'@storybook/addon-controls',
'@storybook/addon-interactions',
'@storybook/addon-themes',
'@storybook/addon-viewport',
],
framework: { name: '@storybook/nextjs', options: {} },
Expand Down
11 changes: 10 additions & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Open_Sans } from 'next/font/google';
import { SiteProvider } from '../providers/siteProvider';
import { ThemeProvider } from '../providers/themeProvider';
import { LocaleProvider } from '../providers/localeProvider';
import type { Preview } from '@storybook/react';
import { withThemeByDataAttribute } from '@storybook/addon-themes';
import type { Preview, ReactRenderer } from '@storybook/react';

import '../styles/new/index.scss';

Expand Down Expand Up @@ -49,6 +50,14 @@ export const decorators = [
</LocaleProvider>
</SiteProvider>
),
withThemeByDataAttribute<ReactRenderer>({
themes: {
light: '',
dark: 'dark',
},
defaultTheme: 'light',
attributeName: 'data-theme',
}),
];

Object.defineProperty(NextImage, 'default', {
Expand Down
215 changes: 215 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"devDependencies": {
"@storybook/addon-controls": "~7.4.0",
"@storybook/addon-interactions": "~7.4.0",
"@storybook/addon-themes": "^7.4.1",
"@storybook/addon-viewport": "~7.4.0",
"@storybook/nextjs": "~7.4.0",
"@testing-library/jest-dom": "~6.1.3",
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ export default {
fontFamily: {
'open-sans': ['var(--font-open-sans)'],
},
darkMode: ['class', '[data-theme="dark"]'],
},
darkMode: ['class', '[data-theme="dark"]'],
} satisfies Config;
Loading