feat: 공용 Toast 비주얼 추가
Co-Authored-By: Claude Opus 5
@84daf2cee51a185c5065e2e422c05bf76b136087
+++ components/ui/toast.tsx
... | ... | @@ -0,0 +1,30 @@ |
| 1 | +import type { ReactNode } from "react"; | |
| 2 | + | |
| 3 | +type ToastVariant = "info" | "success" | "danger" | "warning"; | |
| 4 | + | |
| 5 | +const ACCENT_CLASSES: Record<ToastVariant, string> = { | |
| 6 | + info: "border-l-primary", | |
| 7 | + success: "border-l-success", | |
| 8 | + danger: "border-l-danger", | |
| 9 | + warning: "border-l-warning", | |
| 10 | +}; | |
| 11 | + | |
| 12 | +interface ToastProps { | |
| 13 | + variant?: ToastVariant; | |
| 14 | + children: ReactNode; | |
| 15 | +} | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 알림 비주얼(토스트 1개). 위치·스택·표시 타이머는 호출부(feature) 책임 — | |
| 19 | + * 이 컴포넌트는 상태를 가지지 않는다. | |
| 20 | + */ | |
| 21 | +export function Toast({ variant = "info", children }: ToastProps) { | |
| 22 | + return ( | |
| 23 | + <div | |
| 24 | + role="status" | |
| 25 | + className={`animate-toast-in rounded-lg border-l-4 bg-surface px-4 py-3 text-body-md text-foreground shadow-toast ${ACCENT_CLASSES[variant]}`} | |
| 26 | + > | |
| 27 | + {children} | |
| 28 | + </div> | |
| 29 | + ); | |
| 30 | +} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?