-
Notifications
You must be signed in to change notification settings - Fork 3
스토리북 도입 #21
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
스토리북 도입 #21
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import type { StorybookConfig } from '@storybook/nextjs-vite'; | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
| addons: [ | ||
| '@chromatic-com/storybook', | ||
| '@storybook/addon-vitest', | ||
| '@storybook/addon-a11y', | ||
| '@storybook/addon-docs', | ||
| ], | ||
| framework: '@storybook/nextjs-vite', | ||
| staticDirs: ['../public'], | ||
| }; | ||
| export default config; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| @font-face { | ||
| font-family: 'Pretendard'; | ||
| src: url('/fonts/Pretendard-Regular.woff2') format('woff2'); | ||
| font-weight: 400; | ||
| font-style: normal; | ||
| font-display: swap; | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: 'Pretendard'; | ||
| src: url('/fonts/Pretendard-Medium.woff2') format('woff2'); | ||
| font-weight: 500; | ||
| font-style: normal; | ||
| font-display: swap; | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: 'Pretendard'; | ||
| src: url('/fonts/Pretendard-SemiBold.woff2') format('woff2'); | ||
| font-weight: 600; | ||
| font-style: normal; | ||
| font-display: swap; | ||
| } | ||
|
|
||
| @font-face { | ||
| font-family: 'Pretendard'; | ||
| src: url('/fonts/Pretendard-Bold.woff2') format('woff2'); | ||
| font-weight: 700; | ||
| font-style: normal; | ||
| font-display: swap; | ||
| } | ||
|
|
||
| :root { | ||
| --font-pretendard: 'Pretendard'; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import '../src/app/globals.css'; | ||
| import './preview.css'; | ||
|
|
||
| import type { Preview } from '@storybook/nextjs-vite'; | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| controls: { | ||
| matchers: { | ||
| color: /(background|color)$/i, | ||
| date: /Date$/i, | ||
| }, | ||
| }, | ||
|
|
||
| a11y: { | ||
| // 'todo' - show a11y violations in the test UI only | ||
| // 'error' - fail CI on a11y violations | ||
| // 'off' - skip a11y checks entirely | ||
| test: 'todo', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default preview; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview'; | ||
| import { setProjectAnnotations } from '@storybook/nextjs-vite'; | ||
| import * as projectAnnotations from './preview'; | ||
|
|
||
| // This is an important step to apply the right configuration when testing your stories. | ||
| // More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations | ||
| setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,18 +1,14 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import storybook from "eslint-plugin-storybook"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import { defineConfig, globalIgnores } from 'eslint/config'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import nextVitals from 'eslint-config-next/core-web-vitals'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import nextTs from 'eslint-config-next/typescript'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| export default defineConfig([ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...nextVitals, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...nextTs, | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| rules: { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 'prefer-const': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| export default defineConfig([...nextVitals, ...nextTs, { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| rules: { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 'prefer-const': 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']), ...storybook.configs["flat/recommended"]]); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint 설정이 한 줄로 길게 작성되어 가독성이 떨어집니다. 각 설정을 별도의 줄로 나누어 작성하면 코드를 이해하고 유지보수하기 더 쉬워집니다.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
| "lint": "eslint", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "format": "prettier --write .", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "typecheck": "tsc --noEmit", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "prepare": "husky" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "prepare": "husky", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "storybook": "storybook dev -p 6006", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "build-storybook": "storybook build" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "dependencies": { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@dnd-kit/core": "^6.3.1", | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -35,7 +37,19 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
| "husky": "^9.1.7", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "lint-staged": "^16.2.7", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "prettier": "^3.8.0", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "typescript": "^5" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "typescript": "^5", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "storybook": "^10.2.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/nextjs-vite": "^10.2.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@chromatic-com/storybook": "^5.0.0", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/addon-vitest": "^10.2.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/addon-a11y": "^10.2.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/addon-docs": "^10.2.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "vite": "^7.3.1", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "eslint-plugin-storybook": "^10.2.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "vitest": "^4.0.18", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "playwright": "^1.58.1", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@vitest/browser-playwright": "^4.0.18", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "@vitest/coverage-v8": "^4.0.18" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 추가된
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "lint-staged": { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "*.{ts,tsx,js,jsx}": [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스토리북의 핵심 기능을 모아놓은
@storybook/addon-essentials를 사용하는 것을 권장합니다. 이 애드온은actions,controls,docs등 필수적인 애드온들을 포함하고 있어 개별적으로 관리할 필요가 없게 해주고, 더 풍부한 개발 경험을 제공합니다.@storybook/addon-docs는@storybook/addon-essentials에 포함되어 있으므로 대체할 수 있습니다. 이 애드온을 사용하려면devDependencies에 추가해야 합니다.