Skip to content

Commit 8f7db1a

Browse files
authored
chore: add storybook (#33)
1 parent 0aa0367 commit 8f7db1a

File tree

7 files changed

+1129
-13
lines changed

7 files changed

+1129
-13
lines changed

chat/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ yarn-error.log*
4040
*.tsbuildinfo
4141
next-env.d.ts
4242
.sources.stamp
43+
44+
*storybook.log
45+
storybook-static

chat/.storybook/main.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { StorybookConfig } from "@storybook/nextjs";
2+
3+
const config: StorybookConfig = {
4+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5+
addons: ["@storybook/addon-themes"],
6+
framework: {
7+
name: "@storybook/nextjs",
8+
options: {},
9+
},
10+
staticDirs: ["../public"],
11+
};
12+
export default config;

chat/.storybook/preview.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Preview } from "@storybook/nextjs";
2+
3+
import { withThemeByClassName } from "@storybook/addon-themes";
4+
import "../src/app/globals.css";
5+
6+
const preview: Preview = {
7+
parameters: {
8+
controls: {
9+
matchers: {
10+
color: /(background|color)$/i,
11+
date: /Date$/i,
12+
},
13+
},
14+
},
15+
decorators: [
16+
withThemeByClassName({
17+
themes: {
18+
light: "",
19+
dark: "dark",
20+
},
21+
defaultTheme: "dark",
22+
}),
23+
],
24+
};
25+
26+
export default preview;

chat/bun.lock

Lines changed: 1055 additions & 11 deletions
Large diffs are not rendered by default.

chat/eslint.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
2+
import storybook from "eslint-plugin-storybook";
3+
14
import { dirname } from "path";
25
import { fileURLToPath } from "url";
36
import { FlatCompat } from "@eslint/eslintrc";
@@ -11,6 +14,7 @@ const compat = new FlatCompat({
1114

1215
const eslintConfig = [
1316
...compat.extends("next/core-web-vitals", "next/typescript"),
17+
...storybook.configs["flat/recommended"]
1418
];
1519

1620
export default eslintConfig;

chat/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"lint": "next lint",
1010
"export": "GITHUB_PAGES=true next build",
1111
"serve-static": "npx serve out",
12-
"deploy-gh-pages": "GITHUB_PAGES=true next build && gh-pages -d out --nojekyll -e chat -f"
12+
"deploy-gh-pages": "GITHUB_PAGES=true next build && gh-pages -d out --nojekyll -e chat -f",
13+
"storybook": "storybook dev -p 6006",
14+
"build-storybook": "storybook build"
1315
},
1416
"dependencies": {
1517
"@radix-ui/react-dropdown-menu": "^2.1.14",
@@ -27,15 +29,19 @@
2729
},
2830
"devDependencies": {
2931
"@eslint/eslintrc": "^3",
32+
"@storybook/addon-themes": "^9.0.17",
33+
"@storybook/nextjs": "^9.0.17",
3034
"@tailwindcss/postcss": "^4",
3135
"@types/node": "^20",
3236
"@types/react": "^19",
3337
"@types/react-dom": "^19",
3438
"eslint": "^9",
3539
"eslint-config-next": "15.2.4",
40+
"eslint-plugin-storybook": "^9.0.17",
3641
"gh-pages": "^6.3.0",
42+
"storybook": "^9.0.17",
3743
"tailwindcss": "^4",
3844
"tw-animate-css": "^1.3.0",
3945
"typescript": "^5"
4046
}
41-
}
47+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { Meta, StoryObj } from "@storybook/nextjs";
2+
3+
import MessageInput from "../components/message-input";
4+
5+
const meta = {
6+
title: "Components/MessageInput",
7+
component: MessageInput,
8+
parameters: {
9+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
10+
layout: "centered",
11+
},
12+
} satisfies Meta<typeof MessageInput>;
13+
14+
export default meta;
15+
type Story = StoryObj<typeof meta>;
16+
17+
export const Default: Story = {
18+
args: {
19+
onSendMessage: () => {},
20+
},
21+
};

0 commit comments

Comments
 (0)