"use client"; import { useEffect } from "react"; interface AlertModalProps { isOpen: boolean; onClose: () => void; title?: string; message: string; type?: "info" | "success" | "warning" | "error"; confirmText?: string; showCancel?: boolean; cancelText?: string; onConfirm?: () => void; onCancel?: () => void; } export default function AlertModal({ isOpen, onClose, title, message, type = "info", confirmText = "확인", showCancel = false, cancelText = "취소", onConfirm, onCancel, }: AlertModalProps) { useEffect(() => { const handleEscape = (event: KeyboardEvent) => { if (event.key === "Escape") { onClose(); } }; if (isOpen) { document.addEventListener("keydown", handleEscape); document.body.style.overflow = "hidden"; } return () => { document.removeEventListener("keydown", handleEscape); document.body.style.overflow = "unset"; }; }, [isOpen, onClose]); const handleConfirm = () => { if (onConfirm) { onConfirm(); } else { onClose(); } }; const handleCancel = () => { if (onCancel) { onCancel(); } else { onClose(); } }; const getIcon = () => { switch (type) { case "success": return (
{message}