Skip to content

Commit 6541001

Browse files
committed
feat(storybook): 스토리북 초기 설정 및 가이드 추가
1 parent 8b8c4c9 commit 6541001

File tree

8 files changed

+2680
-408
lines changed

8 files changed

+2680
-408
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
"plugin:react/recommended",
77
"plugin:react/jsx-runtime",
88
"plugin:react-hooks/recommended",
9+
"plugin:storybook/recommended"
910
],
1011
ignorePatterns: ["dist", ".eslintrc.cjs"],
1112
parserOptions: { ecmaVersion: "latest", sourceType: "module" },

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ yarn-debug.log*
2424
yarn-error.log*
2525

2626
# code
27-
.history
27+
.history
28+
*storybook.log
29+
storybook-static

.storybook/main.js

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

.storybook/preview.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @type { import('@storybook/react-webpack5').Preview } */
2+
const preview = {
3+
parameters: {
4+
controls: {
5+
matchers: {
6+
color: /(background|color)$/i,
7+
date: /Date$/i,
8+
},
9+
},
10+
},
11+
};
12+
13+
export default preview;

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ npm run test
161161
npm run test:run
162162
```
163163

164+
```bash
165+
# 컴포넌트를 독립적으로 확인하고 테스트하려면 아래 명령어를 사용한다. (storybook)
166+
npm run storybook
167+
```
168+
164169
---
165170

166171
### 참조
@@ -169,3 +174,4 @@ npm run test:run
169174

170175
1. [vite 공식 가이드 문서(한글)](https://vitejs-kr.github.io/guide/)
171176
2. [개발환경 초기 설정](./Docs/development-env-setting.md)
177+
3. [storybook 공식 가이드 문서](https://storybook.js.org/)

0 commit comments

Comments
 (0)