Skip to content

Commit

Permalink
Add storybook (#11)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lilac authored Mar 24, 2024
1 parent 62a533a commit f5653ae
Show file tree
Hide file tree
Showing 45 changed files with 16,788 additions and 3,007 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "next/core-web-vitals"
"extends": [
"next/core-web-vitals",
"plugin:storybook/recommended"
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

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

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
"@storybook/addon-themes"
],
framework: {
name: "@storybook/nextjs",
options: {},
},
docs: {
autodocs: "tag",
},
staticDirs: ["../public"],
};
export default config;
26 changes: 26 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Preview } from "@storybook/react";
import { withThemeByDataAttribute } from "@storybook/addon-themes";
import '../src/app/globals.css';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},

decorators: [withThemeByDataAttribute({
themes: {
// nameOfTheme: 'dataAttributeForTheme',
light: 'light',
dark: 'dark',
},
defaultTheme: 'light',
attributeName: 'data-mode',
})]
};

export default preview;
16 changes: 16 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app/globals.css",
"baseColor": "slate",
"cssVariables": false
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
Loading

0 comments on commit f5653ae

Please sign in to comment.