import React, { useState } from 'react'; import { X, CheckCircle, AlertCircle, Info } from 'lucide-react'; interface NotificationModalProps { isOpen: boolean; title?: string; message?: string; type?: 'success' | 'error' | 'info'; onConfirm: () => void; } /** * NotificationModal - Component hiển thị thông báo phản hồi cho người dùng */ export const NotificationModal: React.FC = ({ isOpen, title = 'Thông báo', message, type = 'info', onConfirm, }) => { if (!isOpen) return null; const icons = { success: , error: , info: , }; const colors = { success: 'bg-green-600 hover:bg-green-700 shadow-green-100', error: 'bg-red-600 hover:bg-red-700 shadow-red-100', info: 'bg-blue-600 hover:bg-blue-700 shadow-blue-100', }; return (
{/* Backdrop */}
{/* Modal Content */}
{icons[type]}

{title}

{message || "Bạn không được phép gỡ bỏ thành viên này!"}

); }; /** * Custom hook để quản lý trạng thái của NotificationModal */ export const useNotificationModal = () => { const [modalState, setModalState] = useState<{ isOpen: boolean; title?: string; message?: string; type?: 'success' | 'error' | 'info'; }>({ isOpen: false, title: 'Thông báo', message: '', type: 'info', }); const openModal = (title: string, message: string, type: 'success' | 'error' | 'info' = 'info') => { setModalState({ isOpen: true, title, message, type }); }; const closeModal = () => { setModalState((prev) => ({ ...prev, isOpen: false })); }; return { modalState, openModal, closeModal }; };