Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Update to use storybook-dark-mode (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliewongbandue authored Jul 28, 2023
1 parent 80c49e4 commit 7e35b20
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-storysource',
'@nox/addon-themes/dist/register',
'storybook-dark-mode',
],
webpackFinal: (config) => {
config.module.rules.push(storySource);
Expand Down
19 changes: 12 additions & 7 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { themes } from './themes';
import {
ThemedStory,
addThemes,
} from '@nox/addon-themes/dist/utilities';
import { themes as IrisTheme } from '../src/themes';

import { GlobalStyles } from '../src/utils';
import { useEffect, useState } from 'react';
import { ThemeProvider } from 'styled-components';
import { useDarkMode } from 'storybook-dark-mode';

addThemes(themes);
// addThemes(themes);

export const decorators = [
(Story) => (
<ThemedStory>
<ThemeProvider
theme={useDarkMode() ? IrisTheme.dark : IrisTheme.light}
>
<GlobalStyles />
<ForceClientSideRender>{Story()}</ForceClientSideRender>
</ThemedStory>
</ThemeProvider>
),
];

Expand Down Expand Up @@ -531,4 +532,8 @@ export const parameters = {
expanded: true,
hideNoControlsWarning: true,
},
darkMode: {
dark: { ...themes.dark, stylePreview: true },
light: { ...themes.light, stylePreview: true },
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@babel/preset-env": "^7.22.7",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@nox/addon-themes": "^1.1.3",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
Expand Down Expand Up @@ -86,6 +85,7 @@
"rollup-plugin-multi-input": "^1.4.1",
"rollup-plugin-terser": "^7.0.2",
"storybook": "7.0.26",
"storybook-dark-mode": "^3.0.1",
"styled-components": "^5.3.11",
"stylelint": "^13.13.1",
"stylelint-config-recommended": "^4.0.0",
Expand Down
41 changes: 25 additions & 16 deletions pnpm-lock.yaml

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

0 comments on commit 7e35b20

Please # to comment.