From 781e844abf34847e2e00e803060ab3cb68db7cbf Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Tue, 28 Jul 2026 09:03:32 +0000 Subject: [PATCH] Deploy --- src/components/ui/Modal.tsx | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/components/ui/Modal.tsx diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsx new file mode 100644 index 0000000..f957050 --- /dev/null +++ b/src/components/ui/Modal.tsx @@ -0,0 +1,74 @@ +'use client' + +import { useEffect, useCallback } from "react" +import { X } from 'lucide-react' +import { cn } from "@/lib/utils" + +interface ModalProps { + isOpen: boolean + onClose: () => void + title?: string + children: React.ReactNode + className?: string +} + +export default function Modal({ isOpen, onClose, title, children, className }: ModalProps) { + const handleEscape = useCallback((e: KeyboardEvent) => { + if (e.key === "Escape") onClose() + }, [onClose]) + + useEffect(() => { + if (isOpen) { + document.addEventListener("keydown", handleEscape) + document.body.style.overflow = "hidden" + } + return () => { + document.removeEventListener("keydown", handleEscape) + document.body.style.overflow = "unset" + } + }, [isOpen, handleEscape]) + + if (!isOpen) return null + + return ( +
+ + ) +} \ No newline at end of file