import { FC, ReactNode } from 'react'; import toast, { Toast, Toaster, resolveValue } from 'react-hot-toast'; import { FaTimes } from 'react-icons/fa'; const toastToClassName = (toastType: Toast['type']) => { let className: 'alert-success' | 'alert-error' | 'alert-info'; switch (toastType) { case 'success': className = 'alert-success'; break; case 'error': className = 'alert-error'; break; default: className = 'alert-info'; } return className; }; const CustomToast: FC<{ children: ReactNode }> = ({ children }) => { return ( <> {(t) => { const alertType = toastToClassName(t.type); return (

{resolveValue(t.message, t)}

{t.type !== 'loading' && (
)}
); }}
{children} ); }; export default CustomToast;