Skip to content

[Feat] Toast 컴포넌트 제작#18

Merged
leemanjae02 merged 9 commits into
mainfrom
feat/toast-components-17
Jul 12, 2026
Merged

[Feat] Toast 컴포넌트 제작#18
leemanjae02 merged 9 commits into
mainfrom
feat/toast-components-17

Conversation

@leemanjae02

@leemanjae02 leemanjae02 commented Jul 12, 2026

Copy link
Copy Markdown
Member

#️⃣ 연관된 이슈

🚧 Work in Progress

  • 작업 진행 중

📌 주요 변경사항

  • Figma Toast 컴포넌트셋(complete/warning/info/error) 4종을 pill 형태 공용 컴포넌트로 구현
  • 검증 과정에서 발견한 truncate 미동작 버그와 배경색 근사치를 개선
  • 디자인 토큰 자체가 없어 코드로 해결할 수 없는 항목을 known-issue로 기록

📝 작업 내용

  • Toast 컴포넌트 추가: type(complete/warning/info/error)별 아이콘·role(status/alert) 분기, 배경 blur+틴트 2-layer 구조 구현
  • 아이콘 4종 추가: svg-preserve 원본 SVG + generated 아이콘 컴포넌트, barrel index 갱신
  • truncate 버그 수정: 메시지 <p>가 flex item 기본 min-width: auto 때문에 잘리지 않던 문제를 min-w-0 flex-1 추가로 해결
  • 배경색 근사치 개선: bg-static-black(#000000) → bg-label-normal(#17171a)로 Figma #1B1C1E에 더 근접하게 조정
  • 유닛 테스트 추가: 타입별 message 렌더링, role 분기, 아이콘 매핑 검증(9 케이스)
  • 디자인 토큰 누락 기록: Figma가 참조하는 Semantic/Inverse/Background, Semantic/Primary/Normal(#0066FF), Body 2/Normal-Bold(15px)에 대응하는 토큰이 @kusitms.com/tokens에 없어 근사값을 쓰고 있음을 문서화
  • 검증: pnpm exec eslint, pnpm vitest run(Toast 9 tests), pnpm icons:check, pnpm gen:index:check 통과. Storybook과 실제 앱(Vite dev) 렌더링으로 Figma 스펙과 시각 대조 완료

📸 스크린샷 (선택)

스크린샷 2026-07-12 오후 6 58 45

💬 리뷰 요구사항(선택)

  • bg-brand-primary(#3e5efa)와 text-label-14sb(14px)는 Figma 스펙(#0066FF, 15px)과 정확히 일치하는 토큰이 패키지에 없어 근사치로 구현했습니다. 디자인팀 확인 후 토큰이 추가되면 교체가 필요합니다(.claude/known-issues/records/toast-missing-design-tokens.md 참고).
  • Figma 컴포넌트 자체의 sizing은 hug(내용에 맞춰 확장, 잘림 없음)이지만, 실제 알림 스택처럼 폭이 제한되는 사용 맥락을 가정해 truncate를 넣었습니다. 아직 토스트 알림 스택/포지셔닝 컴포넌트가 없어 실제 사용 맥락은 후속 작업에서 확인이 필요합니다.

Summary by CodeRabbit

  • 새 기능
    • 완료/경고/정보/오류 유형을 지원하는 Toast 컴포넌트와 ToastProvider를 추가했습니다.
    • Zustand 기반 useToast 훅으로 토스트 추가/제거 및 자동 만료(최대 4개) 동작을 제공합니다.
  • 문서
    • Toast 디자인 토큰 누락과 근사 토큰 대체/업데이트 절차를 안내하는 문서를 추가했습니다.
  • 테스트
    • Toast 접근성 역할/아이콘/메시지 렌더링, Provider 표시, 타이머 기반 자동 제거 및 큐 동작을 검증하는 테스트를 추가했습니다.
  • 스토리북
    • 유형별 스토리와 전체 미리보기를 추가했습니다.

Figma Toast 컴포넌트셋(complete/warning/info/error)을 pill 형태로 구현
Semantic/Inverse/Background, Semantic/Primary/Normal, Body 2/Normal-Bold(15px)에
대응하는 토큰이 @kusitms.com/tokens에 없어 근사값으로 구현했음을 기록
@github-actions github-actions Bot changed the title feat: Toast 컴포넌트 추가 [Feat] 토스트 컴포넌트 제작 Jul 12, 2026
@github-actions github-actions Bot added the ✨Feature 새로운 기능 label Jul 12, 2026
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1c169e1c-304f-4285-95ab-a54f40eeab96

📥 Commits

Reviewing files that changed from the base of the PR and between f123cef and 2bc49ad.

📒 Files selected for processing (2)
  • src/hooks/common/useToast.test.ts
  • src/hooks/common/useToast.ts

📝 Walkthrough

Walkthrough

Changes

Toast 컴포넌트, Zustand 기반 상태 관리, ToastProvider 통합, 공개 export를 추가했습니다. 타입별 아이콘·접근성 role·자동 제거를 구현하고 Storybook과 단위 테스트로 렌더링 및 상태 동작을 검증합니다.

Toast 시스템

Layer / File(s) Summary
Toast 렌더링 계약과 공개 경로
src/components/common/Toast/*, src/components/common/index.ts, .claude/known-issues/records/...
Toast 타입, 아이콘, 스타일, 메시지, 접근성 role과 common export를 정의하고 디자인 토큰 미존재 사항을 기록합니다.
Toast 상태와 자동 제거
src/hooks/common/useToast.ts, src/hooks/common/index.ts
Zustand 스토어에서 토스트 추가·삭제, 최대 4개 제한, 4000ms 자동 제거를 제공하고 useToast를 공개합니다.
Provider 렌더링과 애플리케이션 연결
src/providers/ToastProvider.tsx, src/App.tsx
스토어의 토스트를 고정 컨테이너에 렌더링하고 App의 Provider 트리에 연결합니다.
Storybook 및 동작 검증
src/components/common/Toast/Toast.stories.tsx, src/components/common/Toast/Toast.test.tsx, src/hooks/common/useToast.test.ts, src/providers/ToastProvider.test.tsx
네 가지 타입 스토리와 컴포넌트·상태·Provider 동작 테스트를 추가합니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 Toast 컴포넌트 제작이라는 핵심 변경을 정확히 반영합니다.
Linked Issues check ✅ Passed 직접 이슈 #17의 Toast 컴포넌트와 아이콘 컴포넌트 제작 요구를 충족합니다.
Out of Scope Changes check ✅ Passed 스토리, 테스트, provider, hook, 문서는 Toast 구현을 보강하는 범위로 보여 별도 이탈은 없습니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/toast-components-17

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

CI 결과

항목 결과
TypeScript 🟢 통과
Prettier 🟢 통과
Generated 🟢 통과
ESLint 🟢 통과
Test 🟢 통과
Build 🟢 통과

@leemanjae02 leemanjae02 changed the title [Feat] 토스트 컴포넌트 제작 [Feat] Toast 컴포넌트 제작 Jul 12, 2026
Container gap 6px + Message frame 좌측 padding 2px = 8px인데
바깥 컴포넌트의 gap 12px(절대위치 배경 레이어와의 간격이라 무관)을
잘못 참조해 gap-3(12px)으로 구현했던 것을 gap-2(8px)로 수정

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/common/Toast/Toast.test.tsx`:
- Around line 6-31: Toast 메시지의 긴 텍스트 truncate 계약을 회귀 테스트로 추가하세요. 기존 메시지 렌더링
테스트에서 메시지 요소를 식별한 뒤 `min-w-0`, `flex-1`, `truncate` 클래스가 모두 적용됐는지 검증하고, `Toast`의
일반 메시지 렌더링 동작은 그대로 유지하세요.

In `@src/components/common/Toast/Toast.tsx`:
- Line 37: Update the Icon element in the Toast component to include
aria-hidden="true", keeping the existing styling and ensuring the decorative
icon is excluded from the accessibility tree.
- Around line 21-33: Toast 컴포넌트의 props 전개에서 HTMLAttributes의 role을 제외하고, 계산된 role
속성을 {...props} 이후에 적용하세요. type이 error이면 항상 alert, 그 외에는 status가 되도록 하며
className과 나머지 props의 기존 동작은 유지하세요.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 22b24c60-6712-4d9b-a476-651e3e5ca2e6

📥 Commits

Reviewing files that changed from the base of the PR and between 9eaf7ec and b18ab91.

⛔ Files ignored due to path filters (9)
  • src/assets/icons/generated/ToastCompleteIcon.tsx is excluded by !**/generated/**
  • src/assets/icons/generated/ToastErrorIcon.tsx is excluded by !**/generated/**
  • src/assets/icons/generated/ToastInfoIcon.tsx is excluded by !**/generated/**
  • src/assets/icons/generated/ToastWarningIcon.tsx is excluded by !**/generated/**
  • src/assets/icons/generated/index.ts is excluded by !**/generated/**
  • src/assets/icons/svg-preserve/toast-complete.svg is excluded by !**/*.svg, !**/*.svg
  • src/assets/icons/svg-preserve/toast-error.svg is excluded by !**/*.svg, !**/*.svg
  • src/assets/icons/svg-preserve/toast-info.svg is excluded by !**/*.svg, !**/*.svg
  • src/assets/icons/svg-preserve/toast-warning.svg is excluded by !**/*.svg, !**/*.svg
📒 Files selected for processing (6)
  • .claude/known-issues/records/toast-missing-design-tokens.md
  • src/components/common/Toast/Toast.stories.tsx
  • src/components/common/Toast/Toast.test.tsx
  • src/components/common/Toast/Toast.tsx
  • src/components/common/Toast/index.ts
  • src/components/common/index.ts

Comment thread src/components/common/Toast/Toast.test.tsx
Comment thread src/components/common/Toast/Toast.tsx
Comment thread src/components/common/Toast/Toast.tsx Outdated
@github-actions

Copy link
Copy Markdown

CI 결과

항목 결과
TypeScript 🟢 통과
Prettier 🟢 통과
Generated 🟢 통과
ESLint 🟢 통과
Test 🟢 통과
Build 🟢 통과

role을 {...props}보다 먼저 지정해 소비자가 role prop을 넘기면
type에 따라 계산된 값(error일 때 alert)이 덮어써질 수 있었음
메시지는 role(status/alert)로 이미 announce되므로
아이콘에 aria-hidden을 추가해 스크린리더 중복 announce 방지
min-w-0/flex-1/truncate가 메시지 요소에 적용되는지 회귀 테스트로 고정
@github-actions

Copy link
Copy Markdown

CI 결과

항목 결과
TypeScript 🟢 통과
Prettier 🟢 통과
Generated 🟢 통과
ESLint 🟢 통과
Test 🟢 통과
Build 🟢 통과

@KyeongJooni KyeongJooni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!! 코멘트 확인 부탁드립니다! :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

각 화면이 토스트 상태 등을 따로 구현하지 않도록 ToastProvider, useToast 같은 공통 세팅까지 하는건 어떨까요?

각 화면이 토스트 노출 상태를 개별 구현하지 않도록 Zustand 기반
전역 store와 useToast 훅, 이를 렌더링하는 ToastProvider를 추가.
위치(우측 하단)/자동 dismiss(4초)/애니메이션 없음은 Figma에
스펙이 없어 임의로 정한 기본값이며, 디자인 확정 시 조정 필요
addToast의 setTimeout 콜백이 removeToast와 동일한 필터 로직을
중복 구현하고 있어 get().removeToast(id) 호출로 통합
@github-actions

Copy link
Copy Markdown

CI 결과

항목 결과
TypeScript 🟢 통과
Prettier 🟢 통과
Generated 🟢 통과
ESLint 🟢 통과
Test 🟢 통과
Build 🟢 통과

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/hooks/common/useToast.ts`:
- Around line 18-30: Update addToast in useToastStore to cap the toast list at a
fixed maximum, retaining only the most recent 3–4 toasts after appending the new
item. Preserve the existing IDs and automatic removal behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 82d554ca-4641-4734-8216-5d4a05e6388e

📥 Commits

Reviewing files that changed from the base of the PR and between ccecb11 and f123cef.

📒 Files selected for processing (6)
  • src/App.tsx
  • src/hooks/common/index.ts
  • src/hooks/common/useToast.test.ts
  • src/hooks/common/useToast.ts
  • src/providers/ToastProvider.test.tsx
  • src/providers/ToastProvider.tsx

Comment thread src/hooks/common/useToast.ts
addToast가 개수 제한 없이 계속 쌓이던 것을 slice로 잘라
최근 MAX_TOASTS(4)개만 유지하도록 수정
@github-actions

Copy link
Copy Markdown

CI 결과

항목 결과
TypeScript 🟢 통과
Prettier 🟢 통과
Generated 🟢 통과
ESLint 🟢 통과
Test 🟢 통과
Build 🟢 통과

@KyeongJooni KyeongJooni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!! :)

@leemanjae02 leemanjae02 merged commit ab4e20d into main Jul 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨Feature 새로운 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] #17 - Toast 컴포넌트 제작

2 participants