'use client'; import React, { useEffect } from 'react'; import { X } from 'lucide-react'; import { Button } from '@/shared/components/Button'; import { cn } from '@/shared/lib/cn'; interface ModalProps { open: boolean; onClose: () => void; title: string; maxWidthClass?: string; children: React.ReactNode; } export function Modal({ open, onClose, title, maxWidthClass = 'max-w-md', children, }: ModalProps) { useEffect(() => { if (!open) return; const onKeyDown = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', onKeyDown); return () => window.removeEventListener('keydown', onKeyDown); }, [open, onClose]); if (!open) return null; return (
e.stopPropagation()} className={cn( 'w-full rounded-2xl bg-surface-1 border border-line shadow-2xl overflow-hidden flex flex-col max-h-[90vh]', maxWidthClass, )} >

{title}

{children}
); } interface ConfirmModalProps { open: boolean; onClose: () => void; onConfirm: () => void | Promise; title: string; description: string; confirmLabel?: string; danger?: boolean; loading?: boolean; } export function ConfirmModal({ open, onClose, onConfirm, title, description, confirmLabel = 'Xác nhận', danger = false, loading = false, }: ConfirmModalProps) { return (

{description}

); }