import { useEffect } from "react";
import { AlertCircle, CheckCircle, Info, X } from "lucide-react";
/**
* 通用消息弹窗
* type: success / error / info
*/
export default function Modal({ type = "info", title, children, onClose }) {
useEffect(() => {
const onKey = (e) => {
if (e.key === "Escape") onClose?.();
};
document.addEventListener("keydown", onKey);
return () => document.removeEventListener("keydown", onKey);
}, [onClose]);
const styles = {
success: { icon: