import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Check, X } from 'lucide-react'; import { cn } from '@/utils/cn'; export type ToastType = 'success' | 'error' | 'info' | 'warning'; export interface ToastProps { message: string; type?: ToastType; duration?: number; onClose: () => void; visible: boolean; } const Toast: React.FC = ({ message, type = 'info', duration = 3000, onClose, visible }) => { const { t } = useTranslation(); useEffect(() => { if (visible) { const timer = setTimeout(() => { onClose(); }, duration); return () => clearTimeout(timer); } }, [visible, duration, onClose]); const icons = { success: , error: , info: ( ), warning: ( ) }; const bgColors = { success: 'bg-green-50 border-green-200', error: 'bg-red-50 border-red-200', info: 'bg-blue-50 border-blue-200', warning: 'bg-yellow-50 border-yellow-200' }; const textColors = { success: 'text-green-800', error: 'text-red-800', info: 'text-blue-800', warning: 'text-yellow-800' }; return (
{icons[type]}

{message}

); }; export default Toast;