"use client"; import { useEffect } from "react"; import { cn } from "@/shared/utils/cn"; export default function Drawer({ isOpen, onClose, title, children, width = "md", className }) { const widths = { sm: "w-[400px]", md: "w-[500px]", lg: "w-[600px]", xl: "w-[800px]", full: "w-full", }; // Lock body scroll when drawer is open useEffect(() => { if (isOpen) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = ""; } return () => { document.body.style.overflow = ""; }; }, [isOpen]); // Handle escape key useEffect(() => { const handleEscape = (e) => { if (e.key === "Escape" && isOpen) { onClose(); } }; document.addEventListener("keydown", handleEscape); return () => document.removeEventListener("keydown", handleEscape); }, [isOpen, onClose]); if (!isOpen) return null; return (