'use client' import { useEffect } from 'react' import { CheckCircle, XCircle, AlertCircle, Info, X } from 'lucide-react' export type ToastType = 'success' | 'error' | 'warning' | 'info' export interface ToastProps { id: string type: ToastType title: string message?: string duration?: number onClose: (id: string) => void } export default function Toast({ id, type, title, message, duration = 5000, onClose }: ToastProps) { useEffect(() => { if (duration > 0) { const timer = setTimeout(() => { onClose(id) }, duration) return () => clearTimeout(timer) } }, [duration, id, onClose]) const configs = { success: { icon: CheckCircle, bgColor: 'bg-gradient-to-r from-emerald-500 to-teal-500', iconColor: 'text-white', borderColor: 'border-emerald-400', }, error: { icon: XCircle, bgColor: 'bg-gradient-to-r from-red-500 to-pink-500', iconColor: 'text-white', borderColor: 'border-red-400', }, warning: { icon: AlertCircle, bgColor: 'bg-gradient-to-r from-yellow-500 to-orange-500', iconColor: 'text-white', borderColor: 'border-yellow-400', }, info: { icon: Info, bgColor: 'bg-gradient-to-r from-blue-500 to-indigo-500', iconColor: 'text-white', borderColor: 'border-blue-400', }, } const config = configs[type] const Icon = config.icon return (
{/* Icon */}
{/* Content */}

{title}

{message && (

{message}

)}
{/* Close button */}
{/* Progress bar */} {duration > 0 && (
)}
) }