snp-global/frontend/src/components/Toast.tsx
HYOJIN b2b268f1e5 chore: 프로젝트 초기 설정 및 팀 워크플로우 구성
- Spring Boot 3.2.1 + React 19 프로젝트 구조
- S&P Global Maritime API Bypass 및 Risk & Compliance Screening 기능
- 팀 워크플로우 v1.6.1 적용 (settings.json, hooks, workflow-version)
- 프론트엔드 빌드 (Vite + TypeScript + Tailwind CSS)
- 메인 카드 레이아웃 CSS Grid 전환

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 15:42:23 +09:00

38 lines
1.0 KiB
TypeScript
Raw Blame 히스토리

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { Toast as ToastType } from '../hooks/useToast';
const TYPE_STYLES: Record<ToastType['type'], string> = {
success: 'bg-emerald-500',
error: 'bg-red-500',
warning: 'bg-amber-500',
info: 'bg-blue-500',
};
interface Props {
toasts: ToastType[];
onRemove: (id: number) => void;
}
export default function ToastContainer({ toasts, onRemove }: Props) {
if (toasts.length === 0) return null;
return (
<div className="fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm">
{toasts.map((toast) => (
<div
key={toast.id}
className={`${TYPE_STYLES[toast.type]} text-white px-4 py-3 rounded-lg shadow-lg
flex items-center justify-between gap-3 animate-slide-in`}
>
<span className="text-sm">{toast.message}</span>
<button
onClick={() => onRemove(toast.id)}
className="text-white/80 hover:text-white text-lg leading-none"
>
×
</button>
</div>
))}
</div>
);
}