"use client"; import { useEffect } from "react"; import { X } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "./Button"; export function Drawer({ open, onClose, title, description, children, side = "left", width = "md", }: { open: boolean; onClose: () => void; title: string; description?: string; children: React.ReactNode; side?: "left" | "right"; width?: "sm" | "md" | "lg"; }) { useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [open, onClose]); if (!open) return null; const widths = { sm: "max-w-sm", md: "max-w-md", lg: "max-w-xl" }; return (