Skip to content

Commit 64a923f

Browse files
update: add stories (#5)
1 parent 256377d commit 64a923f

File tree

12 files changed

+2434
-17
lines changed

12 files changed

+2434
-17
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ coverage
5151
# Misc
5252
*.local
5353
.eslintcache
54+
55+
*storybook.log

.storybook/main.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { StorybookConfig } from "@storybook/react-vite";
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+
],
12+
framework: {
13+
name: "@storybook/react-vite",
14+
options: {},
15+
},
16+
};
17+
export default config;

.storybook/preview.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from "react";
2+
import { Preview } from "@storybook/react";
3+
import "../src/styles/App.css";
4+
5+
const preview: Preview = {
6+
decorators: [
7+
(Story) => (
8+
<div style={{ margin: "3em" }}>
9+
<Story />
10+
</div>
11+
)
12+
],
13+
parameters: {
14+
// Remove the actions parameter
15+
controls: {
16+
matchers: {
17+
color: /(background|color)$/i,
18+
date: /Date$/
19+
}
20+
}
21+
}
22+
};
23+
24+
export default preview;

package.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"preview": "vite preview",
1212
"test": "vitest",
1313
"prepare": "husky",
14-
"pre-commit": ".husky/pre-commit"
14+
"pre-commit": ".husky/pre-commit",
15+
"storybook": "storybook dev -p 6006",
16+
"build-storybook": "storybook build"
1517
},
1618
"dependencies": {
1719
"dom": "^0.0.3",
@@ -22,7 +24,16 @@
2224
"sweetalert2": "^11.14.1"
2325
},
2426
"devDependencies": {
27+
"@chromatic-com/storybook": "^1.9.0",
2528
"@eslint/js": "^9.9.0",
29+
"@storybook/addon-essentials": "^8.3.5",
30+
"@storybook/addon-interactions": "^8.3.5",
31+
"@storybook/addon-links": "^8.3.5",
32+
"@storybook/addon-onboarding": "^8.3.5",
33+
"@storybook/blocks": "^8.3.5",
34+
"@storybook/react": "^8.3.5",
35+
"@storybook/react-vite": "^8.3.5",
36+
"@storybook/test": "^8.3.5",
2637
"@testing-library/jest-dom": "^6.5.0",
2738
"@testing-library/react": "^16.0.1",
2839
"@types/node": "^22.7.4",
@@ -32,9 +43,11 @@
3243
"eslint": "^9.9.0",
3344
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
3445
"eslint-plugin-react-refresh": "^0.4.9",
46+
"eslint-plugin-storybook": "^0.9.0",
3547
"globals": "^15.9.0",
3648
"husky": "^9.1.6",
3749
"jsdom": "^25.0.1",
50+
"storybook": "^8.3.5",
3851
"typescript": "^5.5.3",
3952
"typescript-eslint": "^8.0.1",
4053
"vite": "^5.4.1",
@@ -45,5 +58,10 @@
4558
"*.{js,jsx,ts,tsx}": [
4659
"eslint --fix"
4760
]
61+
},
62+
"eslintConfig": {
63+
"extends": [
64+
"plugin:storybook/recommended"
65+
]
4866
}
4967
}

0 commit comments

Comments
 (0)