Skip to content

Commit

Permalink
feat(ui): add storybook dark mode switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
spicyzboss committed Jan 2, 2024
1 parent fa4e9d4 commit 9735caa
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions libs/web/shared/ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import type { Parameters } from "storybook-framework-qwik";
import type {
Parameters,
Preview,
QwikRenderer,
} from "storybook-framework-qwik";
import { withThemeByDataAttribute } from "@storybook/addon-themes";

import "../src/styles.css";

export const parameters: Parameters = {
export const parameters = {
a11y: {
config: {},
options: {
Expand All @@ -13,4 +18,19 @@ export const parameters: Parameters = {
options: {
showRoots: true,
},
};
} satisfies Parameters;

const preview = {
decorators: [
withThemeByDataAttribute<QwikRenderer<unknown>>({
attributeName: "data-mode",
themes: {
light: "light",
dark: "dark",
},
defaultTheme: "light",
}),
],
} satisfies Preview;

export default preview;

0 comments on commit 9735caa

Please sign in to comment.