import React, { useEffect } from 'react'; import { CheckCircle, XCircle, AlertTriangle, Info, X } from 'lucide-react'; const ICONS = { success: CheckCircle, error: XCircle, warning: AlertTriangle, info: Info, }; const COLORS = { success: 'border-emerald-500/40 bg-emerald-500/10 text-emerald-400', error: 'border-red-500/40 bg-red-500/10 text-red-400', warning: 'border-amber-500/40 bg-amber-500/10 text-amber-400', info: 'border-blue-500/40 bg-blue-500/10 text-blue-400', }; const Toast = ({ toast, onRemove }) => { const Icon = ICONS[toast.type] || Info; useEffect(() => { const t = setTimeout(() => onRemove(toast.id), toast.duration ?? 4000); return () => clearTimeout(t); }, [toast.id, toast.duration, onRemove]); return (
{toast.message}