Repository navigation
[INIT] 공유 UI 패키지 Storybook 초기 구성 및 chromatic 배포 #25
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
Merged
Merged
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5e21bc2
chore(ui): Storybook 의존성 및 실행 스크립트 추가 (#14)
yumin-kim2 26b440c
chore(ui): Storybook 기본 설정 추가 (#14)
yumin-kim2 9371293
chore(ui): Storybook 확인용 스토리 추가 (#14)
yumin-kim2 a6804c1
chore(root): Storybook 실행 스크립트 간소화 (#14)
yumin-kim2 d8196aa
chore(ui): Storybook 설정 주석 제거 (#14)
yumin-kim2 ba3234e
chore(ui): Storybook 접근성 addon 추가 (#14)
yumin-kim2 7ef42d9
chore(ui): develop 최신 변경사항 병합 (#14)
yumin-kim2 4f9a479
chore(ui): Storybook 문서화 addon 구성 (#14)
yumin-kim2 143441f
docs(ui): Storybook 작성 가이드 추가 (#14)
yumin-kim2 ad16210
chore(ui): Storybook preview 옵션 보강 (#14)
yumin-kim2 8e77421
ci(ui): Chromatic 배포 워크플로우 추가 (#14)
yumin-kim2 218a3c0
merge: develop 브랜치 병합 (#14)
yumin-kim2 f83dfad
feat(ui): Storybook 예시 Button 컴포넌트 추가 (#14)
yumin-kim2 fcdaf03
chore(ui): Storybook 및 Chromatic 설정 리뷰 반영 (#14)
yumin-kim2 1110548
fix(ui): Storybook 타입 및 Chromatic 변경 감지 설정 수정 (#14)
yumin-kim2 a00bff3
chore(root): Storybook 빌드 산출물 gitignore 추가 (#14)
yumin-kim2 e9239e7
chore(ui): Chromatic 변경 스토리만 검사하도록 설정 (#14)
yumin-kim2 14d7239
chore(ui): Chromatic 리뷰 반영 (#14)
yumin-kim2 8adfc30
chore(fix): pull-requests write로 변경 (#14)
yumin-kim2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: Chromatic | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - develop | ||
| paths: | ||
| - "packages/timo-design-system/**" | ||
| - ".github/workflows/chromatic.yml" | ||
| - "pnpm-lock.yaml" | ||
| jobs: | ||
| chromatic: | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| runs-on: ubuntu-latest | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| persist-credentials: false | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Publish to Chromatic | ||
| run: pnpm chromatic | ||
| env: | ||
| CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import type { StorybookConfig } from "@storybook/react-vite"; | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], | ||
| addons: [ | ||
| "@storybook/addon-links", | ||
| "@storybook/addon-essentials", | ||
| "@storybook/addon-interactions", | ||
| "@storybook/addon-a11y", | ||
| ], | ||
| framework: { | ||
| name: "@storybook/react-vite", | ||
| options: {}, | ||
| }, | ||
| docs: { | ||
| autodocs: "tag", | ||
| }, | ||
| }; | ||
|
|
||
| export default config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import type { Preview } from "@storybook/react-vite"; | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| controls: { | ||
| matchers: { | ||
| color: /(background|color)$/i, | ||
| date: /Date$/i, | ||
| }, | ||
|
yumin-kim2 marked this conversation as resolved.
Resolved
|
||
| }, | ||
| viewport: { | ||
| viewports: { | ||
| mobile: { name: "Mobile", styles: { width: "375px", height: "812px" } }, | ||
| tablet: { | ||
| name: "Tablet", | ||
| styles: { width: "768px", height: "1024px" }, | ||
| }, | ||
| desktop: { | ||
| name: "Desktop", | ||
| styles: { width: "1280px", height: "900px" }, | ||
| }, | ||
| }, | ||
| defaultViewport: "desktop", | ||
| }, | ||
| layout: "centered", | ||
| backgrounds: { | ||
| default: "white", | ||
| values: [ | ||
| { name: "white", value: "#ffffff" }, | ||
| { name: "gray", value: "#f5f5f5" }, | ||
| { name: "dark", value: "#1f1f1f" }, | ||
| ], | ||
| }, | ||
| options: { | ||
| storySort: { | ||
| order: ["Guides", "Components", "Icons"], | ||
| }, | ||
| }, | ||
| actions: { | ||
| argTypesRegex: "^on[A-Z].*", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default preview; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/timo-design-system/src/components/Button/Button.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { Button } from "./Button"; | ||
|
|
||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
|
|
||
|
|
||
| const meta = { | ||
| title: "Components/Button", | ||
| component: Button, | ||
| tags: ["autodocs"], | ||
| args: { | ||
| children: "Button", | ||
| }, | ||
| argTypes: { | ||
| onClick: { action: "clicked" }, | ||
| }, | ||
| } satisfies Meta<typeof Button>; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = {}; | ||
|
|
||
| export const Disabled: Story = { | ||
| args: { | ||
| disabled: true, | ||
| children: "Disabled", | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import type { ButtonHTMLAttributes } from "react"; | ||
|
|
||
| type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement>; | ||
|
|
||
| export const Button = ({ children, ...props }: ButtonProps) => { | ||
| return <button {...props}>{children}</button>; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { Button } from "./Button"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { Meta } from "@storybook/addon-docs/blocks"; | ||
|
|
||
| <Meta title="Guides/Storybook Guide" /> | ||
|
|
||
| # Storybook Guide | ||
|
|
||
| Timo Design System의 공통 UI 컴포넌트는 Storybook을 통해 상태별 예시와 사용 방법을 문서화합니다. | ||
|
|
||
| ## Story 위치 | ||
|
|
||
| 컴포넌트 story는 컴포넌트와 같은 폴더에 작성합니다. | ||
|
|
||
| ```txt | ||
| components/ | ||
| Button/ | ||
| Button.tsx | ||
| Button.stories.tsx | ||
| index.ts | ||
| ``` | ||
|
|
||
| ## 파일 네이밍 | ||
|
|
||
| Story 파일은 `ComponentName.stories.tsx` 형식을 사용합니다. | ||
|
|
||
| ```txt | ||
| Button.stories.tsx | ||
| Input.stories.tsx | ||
| ``` | ||
|
|
||
| ## 기본 Story 작성 예시 | ||
|
|
||
| ```tsx | ||
| import type { Meta, StoryObj } from "@storybook/react-vite"; | ||
| import { Button } from "./Button"; | ||
|
|
||
| const meta: Meta<typeof Button> = { | ||
| title: "Components/Button", | ||
| component: Button, | ||
| tags: ["autodocs"], | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof Button>; | ||
|
|
||
| export const Default: Story = { | ||
| args: { | ||
| children: "Button", | ||
| }, | ||
| }; | ||
| ``` | ||
|
|
||
| ## Autodocs | ||
|
|
||
| 컴포넌트 문서를 자동 생성하려면 story meta에 `tags: ["autodocs"]`를 추가합니다. | ||
|
|
||
| ```tsx | ||
| const meta: Meta<typeof Button> = { | ||
| title: "Components/Button", | ||
| component: Button, | ||
| tags: ["autodocs"], | ||
| }; | ||
| ``` | ||
|
|
||
| ## Accessibility | ||
|
|
||
| 접근성 검사는 Storybook 하단 패널의 `Accessibility` 탭에서 확인합니다. | ||
|
|
||
| ## Storybook 화면 구성 | ||
|
|
||
| - Sidebar: 등록된 story 목록을 확인합니다. | ||
| - Canvas: 선택한 story가 렌더링되는 영역입니다. | ||
| - Toolbar: viewport, zoom 등을 조정합니다. | ||
| - Addons panel: Controls, Actions, Accessibility 결과를 확인합니다. | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.