{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"website-header","type":"registry:block","title":"Website header","description":"A marketing navbar: a product menu with descriptions, sign in and sign up, and a menu sheet on phones.","dependencies":["lucide-react"],"registryDependencies":["https://dashral.com/r/utils.json","https://dashral.com/r/accordion.json","https://dashral.com/r/button.json","https://dashral.com/r/popover.json","https://dashral.com/r/sheet.json"],"files":[{"path":"registry/dashral/blocks/website-header.tsx","type":"registry:file","target":"components/dashral/blocks/website-header.tsx","content":"\"use client\"\n\nimport { useState } from \"react\"\nimport { BarChart3, BookOpen, ChevronDown, Menu, Plug, ShieldCheck, Sparkles, Users, Workflow, Zap } from \"lucide-react\"\nimport { Accordion } from \"../accordion\"\nimport { Button } from \"../button\"\nimport { Popover } from \"../popover\"\nimport { Sheet } from \"../sheet\"\nimport { cn } from \"../lib/utils\"\n\n// The products named here are real ones, as examples: their names are their owners' trademarks, no affiliation implied. Put in the tools your product really works with.\nconst brands = { payments: \"Stripe\", chat: \"Slack\", crm: \"HubSpot\" }\n\n/** An item in a menu: an icon, a title, a line, and where it goes. */\nexport type MenuEntry = { icon: React.ComponentType<{ className?: string; \"aria-hidden\"?: boolean }>; title: string; text: string; href?: string }\n/** A nav item: a plain link, or a menu that opens a panel (two columns past three items), with a promo under it. */\nexport type NavItem =\n  | { label: string; href: string; icon?: React.ComponentType<{ className?: string; \"aria-hidden\"?: boolean }> }\n  | { label: string; items: MenuEntry[]; promo?: { label: string; text: string; href: string } }\n/** A button: a link with href, or your handler with onClick. */\nexport type BlockAction = { label: string; href?: string; onClick?: () => void }\n\nconst product: MenuEntry[] = [\n  { icon: BarChart3, title: \"Analytics\", text: \"Live numbers for every team, no SQL.\" },\n  { icon: Workflow, title: \"Automations\", text: \"Run the busywork when something changes.\" },\n  { icon: Plug, title: \"Integrations\", text: `${brands.payments}, ${brands.chat}, ${brands.crm} and 40 more.` },\n  { icon: ShieldCheck, title: \"Security\", text: \"SSO, roles and an audit log on every plan.\" },\n]\n\nconst solutions: MenuEntry[] = [\n  { icon: Zap, title: \"Startups\", text: \"Ship a dashboard in a day.\" },\n  { icon: Users, title: \"Agencies\", text: \"One workspace per client.\" },\n  { icon: Sparkles, title: \"Enterprise\", text: \"Self-host, SLA and support.\" },\n]\n\nconst sampleNav: NavItem[] = [\n  { label: \"Product\", items: product, promo: { label: \"New:\", text: \"AI summaries for every report\", href: \"#\" } },\n  { label: \"Solutions\", items: solutions },\n  { label: \"Pricing\", href: \"#\" },\n  { label: \"Docs\", href: \"#\", icon: BookOpen },\n]\n\nfunction MenuList({ items, onPick }: { items: MenuEntry[]; onPick?: () => void }) {\n  return (\n    <ul className=\"grid gap-1\">\n      {items.map(({ icon: Icon, title, text, href }) => (\n        <li key={title}>\n          <a\n            href={href ?? \"#\"}\n            onClick={(event) => {\n              if (!href) event.preventDefault()\n              onPick?.()\n            }}\n            className=\"group flex items-start gap-3 rounded-lg p-2.5 transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50\"\n          >\n            <span className=\"grid size-9 shrink-0 place-items-center rounded-lg border bg-card text-primary-text transition-colors group-hover:border-primary/30\">\n              <Icon className=\"size-4\" aria-hidden />\n            </span>\n            <span className=\"min-w-0\">\n              <span className=\"block text-sm font-medium\">{title}</span>\n              <span className=\"block text-xs leading-relaxed text-muted-foreground\">{text}</span>\n            </span>\n          </a>\n        </li>\n      ))}\n    </ul>\n  )\n}\n\n/** A nav item that opens a panel; the chevron turns while it's open. */\nfunction NavMenu({ label, children, className }: { label: string; children: React.ReactNode; className?: string }) {\n  const [open, setOpen] = useState(false)\n  return (\n    <Popover\n      open={open}\n      onOpenChange={setOpen}\n      align=\"start\"\n      className={cn(\"p-2\", className)}\n      trigger={\n        <button\n          type=\"button\"\n          className=\"inline-flex h-9 items-center gap-1 rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 data-[state=open]:text-foreground\"\n        >\n          {label}\n          <ChevronDown className={cn(\"size-3.5 transition-transform duration-(--duration-standard) ease-spring\", open && \"rotate-180\")} aria-hidden />\n        </button>\n      }\n    >\n      {children}\n    </Popover>\n  )\n}\n\nfunction Logo({ brand }: { brand: { name: string; href: string; logo?: React.ReactNode } }) {\n  return (\n    <a href={brand.href} className=\"flex items-center gap-2 rounded-md font-semibold tracking-tight outline-none focus-visible:ring-2 focus-visible:ring-ring/50\">\n      {brand.logo ?? (\n        <span aria-hidden className=\"grid size-7 place-items-center rounded-lg bg-primary text-primary-foreground\">\n          <Sparkles className=\"size-4\" />\n        </span>\n      )}\n      {brand.name}\n    </a>\n  )\n}\n\n/** A button that follows its action: a link, or a handler (and closes the sheet, `then`). */\nfunction Action({ action, variant, className, then }: { action: BlockAction; variant?: \"ghost\" | \"outline\"; className?: string; then?: () => void }) {\n  return action.href ? (\n    <Button variant={variant} className={className} asChild>\n      <a href={action.href} onClick={then}>\n        {action.label}\n      </a>\n    </Button>\n  ) : (\n    <Button\n      variant={variant}\n      className={className}\n      onClick={() => {\n        action.onClick?.()\n        then?.()\n      }}\n    >\n      {action.label}\n    </Button>\n  )\n}\n\n/**\n * A marketing site's navbar: the logo, menus with a line on each item, plain links, and sign in / sign up. On phones\n * the links move into a sheet, the menus becoming sections that open in place. Every part comes from props.\n */\nexport function WebsiteHeader({\n  brand = { name: \"Acme\", href: \"#\" },\n  nav = sampleNav,\n  signIn = { label: \"Sign in\", href: \"#\" },\n  cta = { label: \"Get started\", href: \"#\" },\n}: {\n  brand?: { name: string; href: string; logo?: React.ReactNode }\n  nav?: NavItem[]\n  /** The quiet button before the main one; null hides it. */\n  signIn?: BlockAction | null\n  cta?: BlockAction\n}) {\n  const [sheetOpen, setSheetOpen] = useState(false)\n  const close = () => setSheetOpen(false)\n  const link = \"inline-flex h-9 items-center rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50\"\n  const menus = nav.filter((item) => \"items\" in item)\n\n  return (\n    <header className=\"sticky top-0 z-30 border-b bg-background/85 px-4 backdrop-blur-md sm:px-6\">\n      <div className=\"mx-auto flex h-16 max-w-6xl items-center gap-6\">\n        <Logo brand={brand} />\n\n        <nav aria-label=\"Main\" className=\"hidden items-center gap-1 md:flex\">\n          {nav.map((item) =>\n            \"items\" in item ? (\n              <NavMenu key={item.label} label={item.label} className={item.items.length > 3 ? \"w-[34rem]\" : \"w-72\"}>\n                {item.items.length > 3 ? (\n                  <div className=\"grid grid-cols-2 gap-1\">\n                    <MenuList items={item.items.slice(0, Math.ceil(item.items.length / 2))} />\n                    <MenuList items={item.items.slice(Math.ceil(item.items.length / 2))} />\n                  </div>\n                ) : (\n                  <MenuList items={item.items} />\n                )}\n                {item.promo && (\n                  <a href={item.promo.href} className=\"mt-2 flex items-center justify-between rounded-lg bg-muted/60 px-3 py-2.5 text-xs transition-colors hover:bg-muted\">\n                    <span>\n                      <span className=\"font-medium\">{item.promo.label}</span> <span className=\"text-muted-foreground\">{item.promo.text}</span>\n                    </span>\n                    <span className=\"font-medium text-primary-text\">Read more →</span>\n                  </a>\n                )}\n              </NavMenu>\n            ) : (\n              <a key={item.label} href={item.href} className={link}>\n                {item.label}\n              </a>\n            )\n          )}\n        </nav>\n\n        <div className=\"ms-auto flex items-center gap-2\">\n          {signIn && <Action action={signIn} variant=\"ghost\" className=\"hidden sm:inline-flex\" />}\n          <Action action={cta} />\n          <Sheet\n            open={sheetOpen}\n            onOpenChange={setSheetOpen}\n            side=\"right\"\n            title=\"Menu\"\n            className=\"w-80\"\n            trigger={\n              <Button variant=\"ghost\" size=\"icon\" aria-label=\"Open the menu\" className=\"md:hidden\">\n                <Menu />\n              </Button>\n            }\n            footer={\n              <div className=\"grid w-full auto-cols-fr grid-flow-col gap-2\">\n                {signIn && <Action action={signIn} variant=\"outline\" then={close} />}\n                <Action action={cta} then={close} />\n              </div>\n            }\n          >\n            {/* -mx-2 with px-2 on each row: the text lines up with the title, the hover reaches a little past it. */}\n            <div className=\"-mx-2 pb-4\">\n              {menus.length > 0 && (\n                <Accordion\n                  items={menus.map((item) => ({ value: item.label, title: item.label, content: <MenuList items={\"items\" in item ? item.items : []} onPick={close} /> }))}\n                  classNames={{ item: \"border-0\", trigger: \"px-2 text-sm\", content: \"px-0\" }}\n                />\n              )}\n              {nav.map((item) =>\n                \"items\" in item ? null : (\n                  <a key={item.label} href={item.href} onClick={close} className=\"flex items-center gap-2 rounded-md px-2 py-3 text-sm font-medium hover:bg-accent\">\n                    {item.icon && <item.icon className=\"size-4 text-muted-foreground\" aria-hidden />}\n                    {item.label}\n                  </a>\n                )\n              )}\n            </div>\n          </Sheet>\n        </div>\n      </div>\n    </header>\n  )\n}\n"}],"cssVars":{"theme":{"color-primary-text":"var(--primary-text, var(--primary))","ease-standard":"var(--ease-standard)","ease-enter":"var(--ease-enter)","ease-exit":"var(--ease-exit)","ease-spring":"var(--ease-spring)"},"light":{"duration-fast":"160ms","duration-standard":"240ms","duration-considered":"480ms","ease-standard":"cubic-bezier(0.2, 0, 0, 1)","ease-enter":"cubic-bezier(0, 0, 0, 1)","ease-exit":"cubic-bezier(0.3, 0, 1, 1)","ease-spring":"linear(0, 0.071 4%, 0.234 8%, 0.433 12%, 0.626 17%, 0.791 21%, 0.917 25%, 1.004 29%, 1.055 33%, 1.079 38%, 1.083 42%, 1.075 46%, 1.06 50%, 1.043 54%, 1.027 58%, 1.015 62%, 1.005 67%, 0.998 71%, 0.995 75%, 0.993 79%, 0.993 83%, 0.994 88%, 0.995 92%, 0.997 96%, 1)"},"dark":{}}}