import { useEffect } from 'react'; import type { ToastType } from '../../stores/uiStore'; interface ToastProps { message: string; type: ToastType; onClose: () => void; duration?: number; } export function Toast({ message, type, onClose, duration = 4000 }: ToastProps) { useEffect(() => { const timer = setTimeout(onClose, duration); return () => clearTimeout(timer); }, [duration, onClose]); const bgColors = { success: 'bg-green-500 dark:bg-green-600', error: 'bg-red-500 dark:bg-red-600', info: 'bg-blue-500 dark:bg-blue-600', warning: 'bg-yellow-500 dark:bg-yellow-600', }; const icons = { success: '✓', error: '✕', info: 'ℹ', warning: '⚠', }; return (
{icons[type]}
{message}
); }