{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"dark-sidebar-with-workspace-switcher-and-user-footer","type":"registry:component","title":"Dark Sidebar With Workspace Switcher and User Footer","description":"","dependencies":[],"files":[{"path":"components/we-inc/dark-sidebar-with-workspace-switcher-and-user-footer.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// Workspaces in the switcher and links in the sidebar.\nconst workspaces = [\n  { name: \"Lumen Records\", plan: \"Team plan\", color: \"bg-violet-500\" },\n  { name: \"Fieldnote Press\", plan: \"Starter plan\", color: \"bg-amber-500\" },\n  { name: \"Saltmarsh Radio\", plan: \"Team plan\", color: \"bg-sky-500\" },\n];\nconst links = [\"Releases\", \"Artists\", \"Royalties\", \"Calendar\", \"Files\"];\n\nexport default function DarkSidebarWithWorkspaceSwitcherAndUserFooter() {\n  const [ws, setWs] = useState(0);\n  const [menu, setMenu] = useState(true);\n  const [current, setCurrent] = useState(\"Releases\");\n  const trigger = useRef<HTMLButtonElement>(null);\n\n  useEffect(() => {\n    if (!menu) return;\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") { setMenu(false); trigger.current?.focus(); }\n    };\n    document.addEventListener(\"keydown\", onKey);\n    return () => document.removeEventListener(\"keydown\", onKey);\n  }, [menu]);\n\n  const active = workspaces[ws];\n\n  return (\n    <div className=\"bg-zinc-100 px-4 py-10 sm:px-8\">\n      <div className=\"mx-auto flex h-[540px] max-w-4xl overflow-hidden rounded-2xl bg-white ring-1 ring-zinc-200\">\n        <aside className=\"relative flex w-full shrink-0 flex-col bg-zinc-900 p-3 text-zinc-100 sm:w-64\">\n          <button\n            ref={trigger}\n            type=\"button\"\n            aria-expanded={menu}\n            aria-controls=\"dsw-list\"\n            onClick={() => setMenu((v) => !v)}\n            className=\"flex h-14 w-full items-center gap-3 rounded-xl px-2 text-left hover:bg-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400\"\n          >\n            <span className={`grid h-9 w-9 shrink-0 place-items-center rounded-lg text-sm font-bold text-zinc-950 ${active.color}`} aria-hidden=\"true\">{active.name[0]}</span>\n            <span className=\"min-w-0 flex-1\">\n              <span className=\"block truncate text-sm font-semibold\">{active.name}</span>\n              <span className=\"block text-xs text-zinc-400\">{active.plan}</span>\n            </span>\n            <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" className=\"text-zinc-400\" aria-hidden=\"true\"><path d=\"M8 9l4-4 4 4M8 15l4 4 4-4\" /></svg>\n          </button>\n\n          <div id=\"dsw-list\" hidden={!menu} className=\"mt-2 rounded-xl bg-zinc-800 p-1.5 shadow-2xl ring-1 ring-white/10\">\n            <p className=\"px-2.5 py-1.5 text-xs font-medium text-zinc-400\">Switch workspace</p>\n            <ul>\n              {workspaces.map((w, i) => (\n                <li key={w.name}>\n                  <button\n                    type=\"button\"\n                    aria-pressed={i === ws}\n                    onClick={() => { setWs(i); setMenu(false); trigger.current?.focus(); }}\n                    className=\"flex h-10 w-full items-center gap-2.5 rounded-lg px-2.5 text-sm hover:bg-zinc-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400\"\n                  >\n                    <span className={`h-2.5 w-2.5 rounded-full ${w.color}`} aria-hidden=\"true\" />\n                    <span className=\"flex-1 text-left\">{w.name}</span>\n                    {i === ws && <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"text-violet-300\" aria-hidden=\"true\"><path d=\"M5 12l5 5 9-10\" /></svg>}\n                  </button>\n                </li>\n              ))}\n            </ul>\n            <a href=\"#\" className=\"mt-1 flex h-10 items-center rounded-lg border-t border-white/10 px-2.5 text-sm text-zinc-300 hover:bg-zinc-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400\">New workspace</a>\n          </div>\n\n          <nav aria-label=\"Main\" className=\"mt-4 flex-1\">\n            <ul className=\"space-y-0.5\">\n              {links.map((l) => (\n                <li key={l}>\n                  <a\n                    href=\"#\"\n                    aria-current={current === l ? \"page\" : undefined}\n                    onClick={(e) => { e.preventDefault(); setCurrent(l); }}\n                    className={`flex h-10 items-center rounded-lg px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400 ${current === l ? \"bg-white/10 font-medium text-white\" : \"text-zinc-300 hover:bg-white/5 hover:text-white\"}`}\n                  >\n                    {l}\n                  </a>\n                </li>\n              ))}\n            </ul>\n          </nav>\n\n          <div className=\"flex items-center gap-3 border-t border-white/10 px-2 pt-3\">\n            <span className=\"grid h-9 w-9 place-items-center rounded-full bg-gradient-to-br from-rose-400 to-orange-300 text-sm font-semibold text-zinc-900\" aria-hidden=\"true\">IM</span>\n            <span className=\"min-w-0 flex-1\">\n              <span className=\"block truncate text-sm font-medium\">Imani Mensah</span>\n              <span className=\"block truncate text-xs text-zinc-400\">imani@lumenrecords.co</span>\n            </span>\n            <a href=\"#\" aria-label=\"Account settings\" className=\"grid h-10 w-10 place-items-center rounded-lg text-zinc-400 hover:bg-white/5 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400\">\n              <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\"><path d=\"M5 12h.01M12 12h.01M19 12h.01\" /></svg>\n            </a>\n          </div>\n        </aside>\n        <main className=\"hidden min-w-0 flex-1 p-6 sm:block\">\n          <p className=\"text-sm text-zinc-600\">{active.name}</p>\n          <h2 className=\"mt-1 text-xl font-semibold text-zinc-900\">{current}</h2>\n          <div className=\"mt-6 grid grid-cols-2 gap-3\" aria-hidden=\"true\">\n            {[0, 1, 2, 3].map((i) => <div key={i} className=\"aspect-square rounded-xl bg-zinc-100\" />)}\n          </div>\n        </main>\n      </div>\n    </div>\n  );\n}\n"}]}
