'use client'; import { useEffect } from 'react'; export interface ToastProps { type: 'success' | 'error' | 'warning' | 'info'; message: string; onClose: () => void; duration?: number; } export function Toast({ type, message, onClose, duration = 3000 }: ToastProps) { useEffect(() => { const timer = setTimeout(onClose, duration); return () => clearTimeout(timer); }, [onClose, duration]); const bgColor = { success: 'bg-green-500', error: 'bg-red-500', warning: 'bg-yellow-500', info: 'bg-blue-500', }[type]; return (
{message}
); }