import { useEffect, useRef } from "react"; import { Icon } from "@/components/ui/Icon"; import type { IconName } from "@/components/ui/Icon"; export interface MobileActionSheetItem { id: string; label: string; icon?: IconName; variant?: "default" | "danger"; onClick: () => void; } interface MobileActionSheetProps { isOpen: boolean; onClose: () => void; title: string; actions: MobileActionSheetItem[]; } export function MobileActionSheet({ isOpen, onClose, title, actions, }: MobileActionSheetProps) { const sheetRef = useRef(null); useEffect(() => { if (isOpen) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = ""; } return () => { document.body.style.overflow = ""; }; }, [isOpen]); useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === "Escape" && isOpen) { onClose(); } }; document.addEventListener("keydown", handleEscape); return () => document.removeEventListener("keydown", handleEscape); }, [isOpen, onClose]); if (!isOpen) return null; return (
e.stopPropagation()} >

{title}

{actions.map((action) => ( ))}
); }