Skip to content

chore: add storybook #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions chat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
.sources.stamp

*storybook.log
storybook-static
12 changes: 12 additions & 0 deletions chat/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { StorybookConfig } from "@storybook/nextjs";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: ["@storybook/addon-themes"],
framework: {
name: "@storybook/nextjs",
options: {},
},
staticDirs: ["../public"],
};
export default config;
26 changes: 26 additions & 0 deletions chat/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Preview } from "@storybook/nextjs";

import { withThemeByClassName } from "@storybook/addon-themes";
import "../src/app/globals.css";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
decorators: [
withThemeByClassName({
themes: {
light: "",
dark: "dark",
},
defaultTheme: "dark",
}),
],
};

export default preview;
1,066 changes: 1,055 additions & 11 deletions chat/bun.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions chat/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from "eslint-plugin-storybook";

import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
Expand All @@ -11,6 +14,7 @@ const compat = new FlatCompat({

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

export default eslintConfig;
10 changes: 8 additions & 2 deletions chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"lint": "next lint",
"export": "GITHUB_PAGES=true next build",
"serve-static": "npx serve out",
"deploy-gh-pages": "GITHUB_PAGES=true next build && gh-pages -d out --nojekyll -e chat -f"
"deploy-gh-pages": "GITHUB_PAGES=true next build && gh-pages -d out --nojekyll -e chat -f",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@radix-ui/react-dropdown-menu": "^2.1.14",
Expand All @@ -27,15 +29,19 @@
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@storybook/addon-themes": "^9.0.17",
"@storybook/nextjs": "^9.0.17",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.2.4",
"eslint-plugin-storybook": "^9.0.17",
"gh-pages": "^6.3.0",
"storybook": "^9.0.17",
"tailwindcss": "^4",
"tw-animate-css": "^1.3.0",
"typescript": "^5"
}
}
}
21 changes: 21 additions & 0 deletions chat/src/stories/message-input.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Meta, StoryObj } from "@storybook/nextjs";

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

const meta = {
title: "Components/MessageInput",
component: MessageInput,
parameters: {
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: "centered",
},
} satisfies Meta<typeof MessageInput>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
onSendMessage: () => {},
},
};