{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"hamburger-menu-as-a-phone-bottom-sheet","type":"registry:component","title":"Hamburger Menu as a Phone Bottom Sheet","description":"","dependencies":[],"files":[{"path":"components/we-inc/hamburger-menu-as-a-phone-bottom-sheet.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// Tiles in the sheet. Each icon is a simple path drawn in a 24x24 box.\nconst items = [\n  { label: \"Timetable\", path: \"M4 5h16v15H4zM4 10h16M9 3v4M15 3v4\" },\n  { label: \"Book a class\", path: \"M12 5v14M5 12h14\" },\n  { label: \"Memberships\", path: \"M3 7h18v10H3zM3 11h18\" },\n  { label: \"Coaches\", path: \"M12 12a4 4 0 100-8 4 4 0 000 8zM4 21a8 8 0 0116 0\" },\n  { label: \"Find us\", path: \"M12 21s7-6.2 7-11.5A7 7 0 005 9.5C5 14.8 12 21 12 21zM12 12a2.5 2.5 0 100-5 2.5 2.5 0 000 5z\" },\n  { label: \"Help\", path: \"M12 21a9 9 0 100-18 9 9 0 000 18zM9.5 9a2.5 2.5 0 114 2c-1 .6-1.5 1.2-1.5 2.5M12 17h.01\" },\n];\n\nexport default function HamburgerMenuAsAPhoneBottomSheet() {\n  const [open, setOpen] = useState(true);\n  const button = useRef<HTMLButtonElement>(null);\n\n  const close = () => {\n    setOpen(false);\n    button.current?.focus();\n  };\n\n  useEffect(() => {\n    if (!open) return;\n    const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && close();\n    document.addEventListener(\"keydown\", onKey);\n    return () => document.removeEventListener(\"keydown\", onKey);\n  }, [open]);\n\n  return (\n    <div className=\"flex justify-center bg-gradient-to-b from-sky-100 to-sky-50 px-4 py-10\">\n      <div className=\"relative h-[600px] w-full max-w-[340px] overflow-hidden rounded-[2.25rem] border-[6px] border-slate-900 bg-white shadow-xl\">\n        <header className=\"flex h-14 items-center justify-between px-4\">\n          <span className=\"text-[15px] font-bold tracking-tight text-slate-900\">Tidewater Climbing</span>\n          <button\n            ref={button}\n            type=\"button\"\n            aria-expanded={open}\n            aria-controls=\"hmb-sheet\"\n            aria-label=\"Open menu\"\n            onClick={() => setOpen(true)}\n            className=\"grid h-11 w-11 place-items-center rounded-full text-slate-900 hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-600\"\n          >\n            <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\"><path d=\"M4 7h16M4 12h16M4 17h10\" /></svg>\n          </button>\n        </header>\n        <div className=\"px-4\">\n          <div className=\"h-40 rounded-2xl bg-gradient-to-br from-sky-500 to-indigo-600 p-4 text-white\">\n            <p className=\"text-xs font-semibold uppercase tracking-wider text-sky-100\">Tonight</p>\n            <p className=\"mt-16 text-xl font-semibold\">Bouldering social, 7pm</p>\n          </div>\n          <div className=\"mt-4 space-y-3\" aria-hidden=\"true\">\n            <div className=\"h-14 rounded-xl bg-slate-100\" />\n            <div className=\"h-14 rounded-xl bg-slate-100\" />\n          </div>\n        </div>\n\n        <div aria-hidden=\"true\" onClick={close} className={`absolute inset-0 bg-slate-900/40 transition-opacity duration-300 motion-reduce:transition-none ${open ? \"opacity-100\" : \"pointer-events-none opacity-0\"}`} />\n        <div\n          id=\"hmb-sheet\"\n          role=\"dialog\"\n          aria-modal=\"true\"\n          aria-labelledby=\"hmb-title\"\n          className={`absolute inset-x-0 bottom-0 rounded-t-3xl bg-white px-4 pb-6 pt-3 shadow-[0_-12px_40px_rgba(15,23,42,0.18)] transition duration-300 ease-out motion-reduce:transition-none ${open ? \"visible translate-y-0\" : \"invisible translate-y-full\"}`}\n        >\n          <div className=\"mx-auto h-1.5 w-10 rounded-full bg-slate-300\" aria-hidden=\"true\" />\n          <div className=\"mt-3 flex items-center justify-between\">\n            <h2 id=\"hmb-title\" className=\"text-base font-semibold text-slate-900\">Menu</h2>\n            <button type=\"button\" onClick={close} className=\"h-10 rounded-full px-3 text-sm font-medium text-sky-700 hover:bg-sky-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-600\">Done</button>\n          </div>\n          <nav aria-label=\"Main\" className=\"mt-3\">\n            <ul className=\"grid grid-cols-3 gap-2\">\n              {items.map((it) => (\n                <li key={it.label}>\n                  <a href=\"#\" className=\"flex h-20 flex-col items-center justify-center gap-1.5 rounded-2xl bg-slate-50 text-xs font-medium text-slate-800 hover:bg-sky-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-600\">\n                    <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"text-sky-700\" aria-hidden=\"true\"><path d={it.path} /></svg>\n                    {it.label}\n                  </a>\n                </li>\n              ))}\n            </ul>\n          </nav>\n          <a href=\"#\" className=\"mt-3 flex h-12 items-center justify-center rounded-2xl bg-slate-900 text-sm font-semibold text-white hover:bg-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-600 focus-visible:ring-offset-2\">Buy a day pass</a>\n        </div>\n      </div>\n    </div>\n  );\n}\n"}]}
