"use client"; import * as React from "react"; import { X } from "lucide-react"; import { Button } from "@/components/ui/button"; /** * A minimal modal dialog. Closes on overlay click and Escape. Centred from sm * up; on a phone it rises from the bottom as a full-width sheet. Either way * it never outgrows the screen — the body scrolls inside it. */ export function Modal({ open, onClose, title, children, }: { open: boolean; onClose: () => void; title: string; children: React.ReactNode; }) { React.useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; document.addEventListener("keydown", onKey); return () => document.removeEventListener("keydown", onKey); }, [open, onClose]); if (!open) return null; return (
e.stopPropagation()} >

{title}

{children}
); }