import { useState, useEffect } from 'react';
import { X, CheckCircle, AlertCircle, Info, AlertTriangle } from 'lucide-react';
export default function NotificationSystem({ theme }) {
const [notifications, setNotifications] = useState([]);
useEffect(() => {
// Слушаем события уведомлений
const handleNotification = (event) => {
const { type, title, message } = event.detail;
addNotification(type, title, message);
};
window.addEventListener('notification', handleNotification);
return () => window.removeEventListener('notification', handleNotification);
}, []);
const addNotification = (type, title, message) => {
const id = Date.now();
const notification = { id, type, title, message };
setNotifications(prev => [...prev, notification]);
// Автоматически удаляем через 5 секунд
setTimeout(() => {
removeNotification(id);
}, 5000);
};
const removeNotification = (id) => {
setNotifications(prev => prev.filter(n => n.id !== id));
};
const getIcon = (type) => {
switch (type) {
case 'success':
return
{notification.message}