{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "header-1",
  "description": "Responsive sticky header with scroll blur effect, animated mobile menu, and adaptive navigation links.",
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/blocks/header/1/header.tsx",
      "content": "\"use client\";\nimport React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { LogoIcon } from \"@/components/logo\";\nimport { MenuToggleIcon } from \"@/components/menu-toggle-icon\";\nimport { Button, buttonVariants } from \"@/components/ui/button\";\nimport { useScroll } from \"@/hooks/use-scroll\";\nimport { cn } from \"@/lib/utils\";\n\nexport function Header() {\n  const [open, setOpen] = React.useState(false);\n  const scrolled = useScroll(10);\n\n  const links = [\n    {\n      label: \"Features\",\n      href: \"#\",\n    },\n    {\n      label: \"Pricing\",\n      href: \"#\",\n    },\n    {\n      label: \"About\",\n      href: \"#\",\n    },\n  ];\n\n  React.useEffect(() => {\n    if (open) {\n      document.body.style.overflow = \"hidden\";\n    } else {\n      document.body.style.overflow = \"\";\n    }\n    return () => {\n      document.body.style.overflow = \"\";\n    };\n  }, [open]);\n\n  return (\n    <header\n      className={cn(\"sticky top-0 z-50 w-full border-transparent border-b\", {\n        \"border-border bg-background/95 backdrop-blur-lg supports-backdrop-filter:bg-background/50\":\n          scrolled,\n      })}\n    >\n      <nav className=\"mx-auto flex h-14 w-full max-w-5xl items-center justify-between px-4\">\n        <div className=\"rounded-md p-2 hover:bg-accent\">\n          <LogoIcon className=\"size-6\" />\n        </div>\n        <div className=\"hidden items-center gap-2 md:flex\">\n          {links.map((link, _i) => (\n            <a\n              className={buttonVariants({ variant: \"ghost\" })}\n              href={link.href}\n              key={link.label}\n            >\n              {link.label}\n            </a>\n          ))}\n          <Button variant=\"outline\">Sign In</Button>\n          <Button>Get Started</Button>\n        </div>\n        <Button\n          aria-controls=\"mobile-menu\"\n          aria-expanded={open}\n          aria-label=\"Toggle menu\"\n          className=\"md:hidden\"\n          onClick={() => setOpen(!open)}\n          size=\"icon\"\n          variant=\"outline\"\n        >\n          <MenuToggleIcon className=\"size-5\" duration={300} open={open} />\n        </Button>\n      </nav>\n      <MobileMenu className=\"flex flex-col justify-between gap-2\" open={open}>\n        <div className=\"grid gap-y-2\">\n          {links.map((link) => (\n            <a\n              className={buttonVariants({\n                variant: \"ghost\",\n                className: \"justify-start\",\n              })}\n              href={link.href}\n              key={link.label}\n            >\n              {link.label}\n            </a>\n          ))}\n        </div>\n        <div className=\"flex flex-col gap-2\">\n          <Button className=\"w-full bg-transparent\" variant=\"outline\">\n            Sign In\n          </Button>\n          <Button className=\"w-full\">Get Started</Button>\n        </div>\n      </MobileMenu>\n    </header>\n  );\n}\n\ntype MobileMenuProps = React.ComponentProps<\"div\"> & {\n  open: boolean;\n};\n\nfunction MobileMenu({ open, children, className, ...props }: MobileMenuProps) {\n  if (!open || typeof window === \"undefined\") {\n    return null;\n  }\n\n  return createPortal(\n    <div\n      className={cn(\n        \"bg-background/95 backdrop-blur-lg supports-backdrop-filter:bg-background/50\",\n        \"fixed top-14 right-0 bottom-0 left-0 z-40 flex flex-col overflow-hidden border-y md:hidden\"\n      )}\n      id=\"mobile-menu\"\n    >\n      <div\n        className={cn(\n          \"data-[slot=open]:zoom-in-97 ease-out data-[slot=open]:animate-in\",\n          \"size-full p-4\",\n          className\n        )}\n        data-slot={open ? \"open\" : \"closed\"}\n        {...props}\n      >\n        {children}\n      </div>\n    </div>,\n    document.body\n  );\n}\n",
      "type": "registry:component"
    },
    {
      "path": "components/logo.tsx",
      "content": "\"use client\";\n\nimport Image from \"next/image\";\nimport { useTheme } from \"next-themes\";\nimport { useEffect, useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\ntype LogoProps = {\n  className?: string;\n};\n\nexport const LogoIcon = ({ className }: LogoProps) => {\n  const { theme, systemTheme } = useTheme();\n  const [mounted, setMounted] = useState(false);\n\n  useEffect(() => {\n    setMounted(true);\n  }, []);\n\n  if (!mounted) {\n    return (\n      <span\n        className={cn(\n          \"inline-block size-6 animate-pulse rounded-full bg-muted\",\n          className\n        )}\n      />\n    );\n  }\n\n  const currentTheme = theme === \"system\" ? systemTheme : theme;\n  const src =\n    currentTheme === \"dark\"\n      ? \"/logo/freddy-logo-icon-light.png\"\n      : \"/logo/freddy-logo-icon-dark.png\";\n\n  return (\n    <Image\n      alt=\"Freddy UI\"\n      className={cn(\"size-6 object-contain\", className)}\n      height={250}\n      priority\n      src={src}\n      width={250}\n    />\n  );\n};\n\nexport const Logo = ({ className }: LogoProps) => {\n  const { theme, systemTheme } = useTheme();\n  const [mounted, setMounted] = useState(false);\n\n  useEffect(() => {\n    setMounted(true);\n  }, []);\n\n  if (!mounted) {\n    return (\n      <span\n        className={cn(\n          \"inline-block h-6 w-24 animate-pulse rounded bg-muted\",\n          className\n        )}\n      />\n    );\n  }\n\n  const currentTheme = theme === \"system\" ? systemTheme : theme;\n  const src =\n    currentTheme === \"dark\"\n      ? \"/logo/freddy-logo-light.png\"\n      : \"/logo/freddy-logo-dark.png\";\n\n  return (\n    <Image\n      alt=\"Freddy UI\"\n      className={cn(\"h-6 w-auto object-contain\", className)}\n      height={106}\n      priority\n      src={src}\n      width={344}\n    />\n  );\n};\n",
      "type": "registry:component"
    },
    {
      "path": "components/menu-toggle-icon.tsx",
      "content": "\"use client\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\ntype MenuToggleProps = React.ComponentProps<\"svg\"> & {\n  open: boolean;\n  duration?: number;\n};\n\nexport function MenuToggleIcon({\n  open,\n  className,\n  fill = \"none\",\n  stroke = \"currentColor\",\n  strokeWidth = 2.5,\n  strokeLinecap = \"round\",\n  strokeLinejoin = \"round\",\n  duration = 500,\n  ...props\n}: MenuToggleProps) {\n  return (\n    <svg\n      className={cn(\n        \"transition-transform ease-in-out\",\n        open && \"-rotate-45\",\n        className\n      )}\n      fill={fill}\n      stroke={stroke}\n      strokeLinecap={strokeLinecap}\n      strokeLinejoin={strokeLinejoin}\n      strokeWidth={strokeWidth}\n      style={{\n        transitionDuration: `${duration}ms`,\n      }}\n      viewBox=\"0 0 32 32\"\n      {...props}\n    >\n      <path\n        className={cn(\n          \"transition-all ease-in-out\",\n          open\n            ? \"[stroke-dasharray:20_300] [stroke-dashoffset:-32.42px]\"\n            : \"[stroke-dasharray:12_63]\"\n        )}\n        d=\"M27 10 13 10C10.8 10 9 8.2 9 6 9 3.5 10.8 2 13 2 15.2 2 17 3.8 17 6L17 26C17 28.2 18.8 30 21 30 23.2 30 25 28.2 25 26 25 23.8 23.2 22 21 22L7 22\"\n        style={{\n          transitionDuration: `${duration}ms`,\n        }}\n      />\n      <path d=\"M7 16 27 16\" />\n    </svg>\n  );\n}\n",
      "type": "registry:component"
    },
    {
      "path": "hooks/use-scroll.ts",
      "content": "\"use client\";\nimport React from \"react\";\n\nexport function useScroll(threshold: number) {\n  const [scrolled, setScrolled] = React.useState(false);\n\n  const onScroll = React.useCallback(() => {\n    setScrolled(window.scrollY > threshold);\n  }, [threshold]);\n\n  React.useEffect(() => {\n    window.addEventListener(\"scroll\", onScroll);\n    return () => window.removeEventListener(\"scroll\", onScroll);\n  }, [onScroll]);\n\n  // also check on first load\n  React.useEffect(() => {\n    onScroll();\n  }, [onScroll]);\n\n  return scrolled;\n}\n",
      "type": "registry:hook"
    }
  ],
  "meta": {
    "height": "50vh",
    "isPinned": true,
    "createdAt": "2024-03-28"
  },
  "categories": [
    "header"
  ],
  "type": "registry:block"
}