From afe72c189240a4bef7284533758dc3d7a4be3fd7 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Wed, 29 Jul 2026 19:04:21 +0000 Subject: [PATCH] Deploy --- src/components/ui/Modal.tsx | 91 +++++++++++++++++++++++++++++++++++++ 1 file changed, 91 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..be249a3 --- /dev/null +++ b/src/components/ui/Modal.tsx @@ -0,0 +1,91 @@ +'use client' + +import { cn } from "@/lib/utils" +import { X } from 'lucide-react' +import { useEffect, useCallback, useRef } from "react" + +interface ModalProps { + isOpen: boolean + onClose: () => void + children: React.ReactNode + className?: string + title?: string + description?: string +} + +export default function Modal({ isOpen, onClose, children, className, title, description }: ModalProps) { + const overlayRef = useRef(null) + + const handleKeyDown = useCallback( + (e: KeyboardEvent) => { + if (e.key === "Escape") { + onClose() + } + }, + [onClose] + ) + + useEffect(() => { + if (isOpen) { + document.addEventListener("keydown", handleKeyDown) + document.body.style.overflow = "hidden" + } + return () => { + document.removeEventListener("keydown", handleKeyDown) + document.body.style.overflow = "unset" + } + }, [isOpen, handleKeyDown]) + + if (!isOpen) return null + + return ( +
+ {/* Overlay */} + + ) +} \ No newline at end of file