Skip to content

Commit f5653ae

Browse files
authored
Add storybook (#11)
* Add storybook version 8.0.0 by running `npx storybook@latest init` * Support dark mode * Add banner stories * Add shadcn-ui since v0 components require it via `npx shadcn-ui@latest init` * Add shadcn-ui components via `npx shadcn-ui@latest add button avatar input card` * Add preview of AI chat to the banner * Change preview of search page to light mode * Make it more like Google search page * Support both light and dark modes * Fix icon color * Fix build errors
1 parent 62a533a commit f5653ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+16788
-3007
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": [
3+
"next/core-web-vitals",
4+
"plugin:storybook/recommended"
5+
]
36
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ yarn-error.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36+
37+
*storybook.log

.storybook/main.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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: [
6+
"@storybook/addon-onboarding",
7+
"@storybook/addon-links",
8+
"@storybook/addon-essentials",
9+
"@chromatic-com/storybook",
10+
"@storybook/addon-interactions",
11+
"@storybook/addon-themes"
12+
],
13+
framework: {
14+
name: "@storybook/nextjs",
15+
options: {},
16+
},
17+
docs: {
18+
autodocs: "tag",
19+
},
20+
staticDirs: ["../public"],
21+
};
22+
export default config;

.storybook/preview.ts

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

components.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "default",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.ts",
8+
"css": "src/app/globals.css",
9+
"baseColor": "slate",
10+
"cssVariables": false
11+
},
12+
"aliases": {
13+
"components": "@/components",
14+
"utils": "@/lib/utils"
15+
}
16+
}

0 commit comments

Comments
 (0)