import { useEffect } from 'react';
interface ToastNotifProps {
  message: string;
  onDone: () => void;
  type?: 'success' | 'error' | 'info';
}
export default function ToastNotif({ message, onDone, type = 'success' }: ToastNotifProps) {
  useEffect(() => {
    const t = setTimeout(onDone, 3000);
    return () => clearTimeout(t);
  }, [onDone]);
  const colors = { success: 'bg-green-600', error: 'bg-red-500', info: 'bg-blue-500' };
  const icons = { success: 'ri-checkbox-circle-line', error: 'ri-error-warning-line', info: 'ri-information-line' };
  return (
    <div className={`fixed top-20 right-6 z-[200] ${colors[type]} text-white px-5 py-3 rounded-xl shadow-lg flex items-center gap-2`}>
      <div className="w-5 h-5 flex items-center justify-center"><i className={`${icons[type]} text-lg`}></i></div>
      <span className="text-sm font-medium">{message}</span>
    </div>
  );
}
