From 41c06a4a8ac4ab895cdd3f38804c5c9298151521 Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Thu, 4 Jun 2026 09:17:03 +0000 Subject: [PATCH] Deploy --- src/components/ui/Modal.tsx | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 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..644b789 --- /dev/null +++ b/src/components/ui/Modal.tsx @@ -0,0 +1,73 @@ +'use client' + +import { cn } from "@/lib/utils" +import { X } from 'lucide-react' +import React, { useEffect, useCallback } from "react" + +interface ModalProps { + open: boolean + onClose: () => void + title?: string + children: React.ReactNode + className?: string +} + +export default function Modal({ open, onClose, title, children, className }: ModalProps) { + const handleEscape = useCallback( + (e: KeyboardEvent) => { + if (e.key === "Escape") onClose() + }, + [onClose] + ) + + useEffect(() => { + if (open) { + document.addEventListener("keydown", handleEscape) + document.body.style.overflow = "hidden" + } + return () => { + document.removeEventListener("keydown", handleEscape) + document.body.style.overflow = "" + } + }, [open, handleEscape]) + + if (!open) return null + + return ( +
+ {/* Backdrop */} + + ) +} \ No newline at end of file