import React, { useEffect } from 'react'; import { CheckCircle, AlertCircle, X } from 'lucide-react'; export type ToastType = 'success' | 'error' | 'info'; interface ToastProps { message: string; type?: ToastType; isVisible: boolean; onClose: () => void; duration?: number; } export const Toast: React.FC = ({ message, type = 'success', isVisible, onClose, duration = 3000 }) => { useEffect(() => { if (isVisible && duration > 0) { const timer = setTimeout(() => { onClose(); }, duration); return () => clearTimeout(timer); } }, [isVisible, duration, onClose]); if (!isVisible) return null; const bgColors = { success: 'bg-zinc-900 border-green-500/50 text-white', error: 'bg-zinc-900 border-red-500/50 text-white', info: 'bg-zinc-900 border-blue-500/50 text-white', }; const icons = { success: , error: , info: , }; return (
{icons[type]} {message}
); };