import { motion, AnimatePresence } from 'framer-motion';
import { FaCheckCircle, FaExclamationCircle, FaExclamationTriangle, FaInfoCircle, FaTimes } from 'react-icons/fa';
import styles from './Toast.module.css';
import { useLanguage } from '../../../providers/language/LanguageContext';
export type ToastType = 'success' | 'error' | 'warning' | 'info';
export interface ToastData {
id: string;
type: ToastType;
title: string;
message?: string;
duration?: number;
}
interface ToastProps {
toast: ToastData;
onClose: (id: string) => void;
}
const _getIcon = (type: ToastType) => {
switch (type) {
case 'success':
return ;
case 'error':
return ;
case 'warning':
return ;
case 'info':
return ;
}
};
export const Toast: React.FC = ({ toast, onClose }) => {
const { t } = useLanguage();
return (
{_getIcon(toast.type)}
{toast.title}
{toast.message &&
{toast.message}
}
);
};
interface ToastContainerProps {
toasts: ToastData[];
onClose: (id: string) => void;
}
export const ToastContainer: React.FC = ({ toasts, onClose }) => {
return (
{toasts.map((toast) => (
))}
);
};