Skip to content

Commit 7592167

Browse files
authored
docs: storybook themes (#5855)
1 parent 532a890 commit 7592167

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.storybook/preview.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import DocsContainer from './components/DocsContainer'
1010
import Page from './components/Page'
1111
import { dark, light } from './storybookThemes'
1212
import '@ultraviolet/fonts/fonts.css'
13+
import { withThemeByClassName } from '@storybook/addon-themes'
1314

1415
import { scan } from "react-scan"
1516

@@ -140,6 +141,21 @@ const withThemeProvider = (Story: StoryFn, context: { globals: { theme: string }
140141
)
141142
}
142143

144+
145+
const preview: Preview = {
146+
decorators: [
147+
withThemeByClassName({
148+
themes: {
149+
light: '',
150+
dark: 'dark',
151+
darker: "darker"
152+
},
153+
defaultTheme: 'light',
154+
}),
155+
],
156+
};
157+
158+
143159
const decorators = [
144160
(Story: StoryFn, context: { globals: { theme: string } }) => {
145161
const theme = context.globals.theme || "light"
@@ -171,5 +187,6 @@ const decorators = [
171187
export default {
172188
parameters,
173189
decorators,
190+
preview,
174191
tags: ['autodocs']
175192
} satisfies Preview

0 commit comments

Comments
 (0)