Skip to content

Commit 1edab45

Browse files
committed
chore: add theme support in storybook
1 parent 4b95352 commit 1edab45

5 files changed

Lines changed: 28 additions & 18 deletions

File tree

chat/.storybook/main.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
import type { StorybookConfig } from '@storybook/nextjs';
1+
import type { StorybookConfig } from "@storybook/nextjs";
22

33
const config: StorybookConfig = {
4-
"stories": [
5-
"../src/**/*.mdx",
6-
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
7-
],
8-
"addons": [],
9-
"framework": {
10-
"name": "@storybook/nextjs",
11-
"options": {}
4+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5+
addons: ["@storybook/addon-themes"],
6+
framework: {
7+
name: "@storybook/nextjs",
8+
options: {},
129
},
13-
"staticDirs": [
14-
"../public"
15-
]
10+
staticDirs: ["../public"],
1611
};
17-
export default config;
12+
export default config;

chat/.storybook/preview.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
import type { Preview } from '@storybook/nextjs'
1+
import { Preview } from "@storybook/nextjs";
2+
3+
import { withThemeByClassName } from "@storybook/addon-themes";
4+
import "../src/app/globals.css";
25

36
const preview: Preview = {
47
parameters: {
58
controls: {
69
matchers: {
7-
color: /(background|color)$/i,
8-
date: /Date$/i,
10+
color: /(background|color)$/i,
11+
date: /Date$/i,
912
},
1013
},
1114
},
15+
decorators: [
16+
withThemeByClassName({
17+
themes: {
18+
light: "",
19+
dark: "dark",
20+
},
21+
defaultTheme: "dark",
22+
}),
23+
],
1224
};
1325

14-
export default preview;
26+
export default preview;

chat/bun.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chat/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
},
3030
"devDependencies": {
3131
"@eslint/eslintrc": "^3",
32+
"@storybook/addon-themes": "^9.0.17",
3233
"@storybook/nextjs": "^9.0.17",
3334
"@tailwindcss/postcss": "^4",
3435
"@types/node": "^20",

chat/src/stories/message-input.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Meta, StoryObj } from "@storybook/nextjs";
2-
import "../app/globals.css";
32

43
import MessageInput from "../components/message-input";
54

0 commit comments

Comments
 (0)