-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(design-system): 레벨 컴포넌트 #36
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
Changes from all commits
32d609d
3622ac0
cdf8494
658d92b
8ba0970
56d500d
a1ebf90
4340935
fe2a58b
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,28 @@ | ||
| import type { StorybookConfig } from '@storybook/react-vite'; | ||
|
|
||
| import { join, dirname } from "path" | ||
|
|
||
| /** | ||
| * This function is used to resolve the absolute path of a package. | ||
| * It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
| */ | ||
| function getAbsolutePath(value: string): any { | ||
| return dirname(require.resolve(join(value, 'package.json'))) | ||
| } | ||
| const config: StorybookConfig = { | ||
| "stories": [ | ||
| "../stories/**/*.mdx", | ||
| "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)" | ||
| ], | ||
| "addons": [ | ||
| getAbsolutePath('@chromatic-com/storybook'), | ||
| getAbsolutePath('@storybook/addon-docs'), | ||
| getAbsolutePath("@storybook/addon-a11y"), | ||
| getAbsolutePath("@storybook/addon-vitest") | ||
| ], | ||
| "framework": { | ||
| "name": getAbsolutePath('@storybook/react-vite'), | ||
| "options": {} | ||
| } | ||
| }; | ||
| export default config; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import type { Preview } from '@storybook/react-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/react-vite'; | ||
|
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. setProjectAnnotations import 경로가 잘못되었습니다: '@storybook/react'로 교체 필요 portable stories + Vitest 문서 기준 setProjectAnnotations는 프레임워크 패키지(예: '@storybook/react')가 내보내며, '@storybook/react-vite'는 빌더 프레임워크 이름입니다. 현 상태에선 타입/런타임 오류 가능성이 높습니다. 다음 패치를 적용해 주세요. -import { setProjectAnnotations } from '@storybook/react-vite';
+import { setProjectAnnotations } from '@storybook/react';🤖 Prompt for AI Agents |
||
| 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,7 @@ function App() { | |||||
| <img src={reactLogo} className="logo react" alt="React logo" /> | ||||||
| </a> | ||||||
| </div> | ||||||
| <h1>Vite + React</h1> | ||||||
| <h1>Vite + React</h1>\ | ||||||
|
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. TSX 구문 오류: 닫는 태그 뒤 백슬래시 제거 필요 닫는 태그 뒤에 붙은 수정안: - <h1>Vite + React</h1>\
+ <h1>Vite + React</h1>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| <div className="card"> | ||||||
| <button onClick={() => setCount((count) => count + 1)}> | ||||||
| count is {count} | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,16 +7,28 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "lint": "turbo run lint", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "format": "prettier --write \"**/*.{ts,tsx,md}\"", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "check-types": "turbo run check-types", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "test": "turbo run test" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "test": "turbo run test", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "storybook": "storybook dev -p 6006", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "build-storybook": "storybook build" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "devDependencies": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@chromatic-com/storybook": "^4.1.1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@pivanov/vite-plugin-svg-sprite": "^3.1.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/addon-a11y": "^9.1.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/addon-docs": "^9.1.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/addon-vitest": "^9.1.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@storybook/react-vite": "^9.1.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@trivago/prettier-plugin-sort-imports": "^5.2.2", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "prettier": "^3.6.2", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "prettier-plugin-tailwindcss": "^0.6.14", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "storybook": "^9.1.3", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "turbo": "^2.5.6", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "typescript": "5.9.2", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "vite": "7.1.2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "vite": "7.1.2", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "vitest": "^3.2.4", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@vitest/browser": "^3.2.4", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "playwright": "^1.55.0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "@vitest/coverage-v8": "^3.2.4" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
14
to
+31
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. 🛠️ Refactor suggestion MDX 블록 컴포넌트를 사용한다면 '@storybook/blocks' 의존성을 추가하세요.
"devDependencies": {
"@chromatic-com/storybook": "^4.1.1",
"@pivanov/vite-plugin-svg-sprite": "^3.1.3",
"@storybook/addon-a11y": "^9.1.3",
"@storybook/addon-docs": "^9.1.3",
"@storybook/addon-vitest": "^9.1.3",
"@storybook/react-vite": "^9.1.3",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
+ "@storybook/blocks": "^8.6.14",
"storybook": "^9.1.3",
"turbo": "^2.5.6",
"typescript": "5.9.2",
"vite": "7.1.2",
"vitest": "^3.2.4",
"@vitest/browser": "^3.2.4",
"playwright": "^1.55.0",
"@vitest/coverage-v8": "^3.2.4"
},참고: 장기 학습에 따라 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "pnpm": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "overrides": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| export { default as Button } from './button/Button'; | ||
| export { Switch } from './switch/Switch'; | ||
| export { default as Input } from './input/Input'; | ||
| export { default as Level } from './level/Level'; | ||
| export { Textarea } from './textarea/Textarea'; | ||
| export { Progress } from './progress/Progress'; |
|
Member
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.
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||
| import type { Meta, StoryObj } from '@storybook/react-vite'; | ||||||
|
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. Story 타입 import 대상이 잘못되었습니다. 스토리 파일에서는 타입을 -import type { Meta, StoryObj } from '@storybook/react-vite';
+import type { Meta, StoryObj } from '@storybook/react';📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| import Level from './Level'; | ||||||
|
|
||||||
| const meta: Meta<typeof Level> = { | ||||||
| title: 'Components/Level', | ||||||
| component: Level, | ||||||
| tags: ['autodocs'], | ||||||
| parameters: { | ||||||
| layout: 'centered', | ||||||
| }, | ||||||
| argTypes: { | ||||||
| level: { | ||||||
| control: { type: 'number', min: 1, max: 100 }, | ||||||
| description: '현재 레벨 값', | ||||||
| }, | ||||||
| }, | ||||||
| }; | ||||||
| export default meta; | ||||||
|
|
||||||
| type Story = StoryObj<typeof Level>; | ||||||
|
|
||||||
| // 기본 예시 | ||||||
| export const Default: Story = { | ||||||
| args: { | ||||||
| level: 1, | ||||||
| }, | ||||||
| }; | ||||||
|
|
||||||
| export const Level10: Story = { | ||||||
| args: { | ||||||
| level: 10, | ||||||
| }, | ||||||
| }; | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| interface LevelProps { | ||
| level: number; | ||
| } | ||
| const Level = ({ level }: LevelProps) => { | ||
| return ( | ||
| <span className="caption2-sb text-main600 bg-main100 rounded-[0.4rem] px-[0.8rem] py-[0.2rem]"> | ||
| Lv.{level} | ||
| </span> | ||
| ); | ||
| }; | ||
|
|
||
| export default Level; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import path from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| import { defineConfig } from 'vitest/config'; | ||
|
|
||
| import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'; | ||
|
|
||
| const dirname = | ||
| typeof __dirname !== 'undefined' | ||
| ? __dirname | ||
| : path.dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| // More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon | ||
| export default defineConfig({ | ||
| test: { | ||
| projects: [ | ||
| { | ||
| extends: true, | ||
| plugins: [ | ||
| // The plugin will run tests for the stories defined in your Storybook config | ||
| // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest | ||
| storybookTest({ configDir: path.join(dirname, '.storybook') }), | ||
| ], | ||
| test: { | ||
| name: 'storybook', | ||
| browser: { | ||
| enabled: true, | ||
| headless: true, | ||
| provider: 'playwright', | ||
| instances: [{ browser: 'chromium' }], | ||
| }, | ||
|
Comment on lines
+26
to
+31
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. 💡 Verification agent 🧩 Analysis chainPlaywright 런타임/브라우저 설치 확인 필요 provider가 'playwright'이므로 devDependencies에 playwright-core 또는 @playwright/test가 설치되어야 하며, 브라우저 바이너리(chromium)도 사전 설치가 필요합니다. 패키지 누락/브라우저 미설치 시 CI에서 바로 실패합니다. 다음 스크립트로 의존성 여부를 점검해 주세요(리포지토리 루트에서 실행). 🏁 Script executed: #!/bin/bash
# devDependencies에 playwright 관련 패키지 확인
rg -n '"devDependencies"\s*:\s*{[^}]*}' -N package.json | sed -n '1p'
rg -nP '"(@?playwright/(test|.*)|playwright(-core)?)"\s*:\s*"[^\"]+"' package.json -n -C1
# 스토리북/비텟 플러그인 존재 확인
rg -n "@storybook/addon-vitest|vitest-plugin" package.json -n -C1
# (참고) 로컬에서는 아래로 브라우저 설치
echo "Install browsers: npx playwright install chromium"Length of output: 712 Playwright 런타임 및 브라우저 바이너리 설치 확인 필요
🤖 Prompt for AI Agents |
||
| setupFiles: ['.storybook/vitest.setup.ts'], | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /// <reference types="@vitest/browser/providers/playwright" /> | ||
|
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. 💡 Verification agent 🧩 Analysis chain타입 참조 경로 유효성 및 의존성 확인 삼중 슬래시 타입 참조는 간단하지만, 해당 타입 패키지들이 실제 의존성에 존재해야 합니다. 루트 혹은 워크스페이스 패키지에 다음 스크립트로 모든 패키지에서 의존성 존재 여부를 점검할 수 있습니다: 🏁 Script executed: #!/bin/bash
# 모든 package.json에서 관련 의존성 확인
set -euo pipefail
fd -H -E "node_modules" "package.json" | while read -r pkg; do
echo "==> $pkg"
jq -r '
{
deps: (.dependencies // {}) + (.devDependencies // {}),
name: .name
} as $p
| $p.name,
([" vitest: ", ( ($p.deps.vitest // "MISSING") | tostring )] | join("")),
([" @vitest/browser: ", ( ($p.deps["@vitest/browser"] // "MISSING") | tostring )] | join("")),
([" playwright or @playwright/test: ", ( ($p.deps.playwright // ($p.deps["@playwright/test"] // "MISSING")) | tostring )] | join(""))
' "$pkg"
done
echo
echo "tsconfig include에 vitest.shims.d.ts가 포함되는지 확인:"
fd -H -E "node_modules" "tsconfig*.json" | while read -r ts; do
echo "==> $ts"
jq '.include // []' "$ts"
doneLength of output: 845 jq 문법 오류로 인해 의존성 확인 스크립트가 실패했습니다. 아래 스크립트로 다시 실행하여 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
# 모든 package.json에서 관련 의존성 확인
fd -H -E "node_modules" "package.json" | while read -r pkg; do
echo "==> $pkg"
vitest_ver=$(jq -r '.dependencies.vitest // .devDependencies.vitest // "MISSING"' "$pkg")
browser_ver=$(jq -r '.dependencies["@vitest/browser"] // .devDependencies["@vitest/browser"] // "MISSING"' "$pkg")
play_ver=$(jq -r '.dependencies.playwright // .dependencies["@playwright/test"] // .devDependencies.playwright // .devDependencies["@playwright/test"] // "MISSING"' "$pkg")
echo " vitest: $vitest_ver"
echo " @vitest/browser: $browser_ver"
echo " playwright or @playwright/test: $play_ver"
done
echo
# tsconfig include에 vitest.shims.d.ts가 포함되는지 확인
fd -H -E "node_modules" "tsconfig*.json" | while read -r ts; do
echo "==> $ts"
jq -r '.include // []' "$ts"
doneLength of output: 7088 devDependencies 및 tsconfig 설정 보강 필요 다음 두 가지 항목을 점검하고 부족한 부분을 보강해 주세요: • devDependencies 확인 • tsconfig.json의 include 설정 위 두 항목을 반영한 뒤, 테스트가 정상 실행되는지 확인해 주세요.
🤖 Prompt for AI Agents |
||
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.
스토리 탐색 글롭이 패키지 내 컴포넌트 스토리를 누락합니다 (Level.stories.tsx가 로드되지 않음).
현재 설정은
../stories/**만 대상으로 하므로packages/design-system/src/**/Level.stories.tsx가 스토리북에 나타나지 않습니다. 모노레포 전역에서 스토리를 탐색하도록 글롭을 확장해 주세요.다음 패치를 제안합니다:
"stories": [ "../stories/**/*.mdx", - "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)" + "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)", + "../packages/**/*.mdx", + "../packages/**/*.stories.@(js|jsx|mjs|ts|tsx)" ],📝 Committable suggestion
🤖 Prompt for AI Agents