Skip to content

Commit

Permalink
set up @storybook/addon-themes
Browse files Browse the repository at this point in the history
  • Loading branch information
DaleSeo committed Dec 25, 2024
1 parent 8d37e8a commit 8d08e93
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const config: StorybookConfig = {
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
"@storybook/addon-a11y"
"@storybook/addon-a11y",
"@storybook/addon-themes",
],
framework: {
name: "@storybook/react-vite",
Expand Down
13 changes: 11 additions & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "../src/index.css";

import type { Preview } from "@storybook/react";
import { withThemeByClassName } from "@storybook/addon-themes";
import type { Preview, ReactRenderer } from "@storybook/react";

const preview: Preview = {
parameters: {
Expand All @@ -14,6 +14,15 @@ const preview: Preview = {
toc: true,
},
},
decorators: [
withThemeByClassName<ReactRenderer>({
themes: {
light: "",
dark: "dark",
},
defaultTheme: "light",
}),
],
tags: ["autodocs"],
};

Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-interactions": "^8.4.7",
"@storybook/addon-links": "^8.4.7",
"@storybook/addon-themes": "^8.4.7",
"@storybook/blocks": "^8.4.7",
"@storybook/react": "^8.4.7",
"@storybook/react-vite": "^8.4.7",
Expand Down
2 changes: 1 addition & 1 deletion src/styles/globalCss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineGlobalStyles } from "@pandacss/dev";

export const globalCss = defineGlobalStyles({
":root": {
"--global-font-body": "var (--fonts-sans)",
"--global-font-body": "var(--fonts-sans)",
},
h1: {
fontSize: "var(--font-sizes-4xl)", // 2.25rem
Expand Down

0 comments on commit 8d08e93

Please sign in to comment.