{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "headers-02",
  "title": "Minimal floating navbar",
  "description": "A rounded bar with four links under a highlight that follows the pointer, and a sheet that holds the links on phones.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/selected-mark.json",
    "https://ui.ndekocode.dev/r/sheet.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/headers/headers-02/index.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { FernpostMark } from './brand-mark';\nimport { DEFAULT_LINK_ID, NAV_LINKS } from './data';\nimport { MobileSheet } from './mobile-sheet';\nimport { NavLinks } from './nav-links';\n\nexport default function Headers02() {\n  const [currentId, setCurrentId] = useState(DEFAULT_LINK_ID);\n\n  return (\n    <header className='px-4 pt-4 sm:px-6'>\n      <div className='bg-card hairline-ring ring-border dark:bg-foreground/[0.04] mx-auto flex h-14 max-w-4xl items-center gap-3 rounded-full ps-4 pe-2 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'>\n        <a\n          href='#'\n          className='focus-visible:ring-ring/25 flex items-center gap-2 rounded-full text-sm font-semibold outline-none focus-visible:ring-[3px]'\n        >\n          <FernpostMark />\n          Fernpost\n        </a>\n        <div className='flex flex-1 justify-center'>\n          <NavLinks\n            links={NAV_LINKS}\n            currentId={currentId}\n            onNavigate={setCurrentId}\n          />\n        </div>\n        <div className='flex items-center gap-1'>\n          <Button\n            variant='ghost'\n            className='hidden md:inline-flex'\n            nativeButton={false}\n            render={<a href='#' />}\n          >\n            Sign in\n          </Button>\n          <Button nativeButton={false} render={<a href='#' />}>\n            Start writing\n          </Button>\n          <MobileSheet\n            links={NAV_LINKS}\n            currentId={currentId}\n            onNavigate={setCurrentId}\n          />\n        </div>\n      </div>\n    </header>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/headers-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/headers/headers-02/nav-links.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion, type Transition } from 'motion/react';\nimport { useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\n\nimport { type NavLink } from './data';\n\nconst HIGHLIGHT_TRANSITION: Transition = {\n  type: 'spring',\n  bounce: 0,\n  duration: 0.3,\n};\n\nconst INSTANT_LAYOUT: Transition = {\n  layout: { duration: 0 },\n  opacity: { duration: 0.15 },\n};\n\nfunction highlightTransitionOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT_LAYOUT;\n  }\n  return HIGHLIGHT_TRANSITION;\n}\n\nfunction currentAttributeOf(isCurrent: boolean) {\n  if (isCurrent) {\n    return 'page' as const;\n  }\n  return undefined;\n}\n\ntype NavLinksProps = {\n  links: NavLink[];\n  currentId: string;\n  onNavigate: (id: string) => void;\n};\n\nexport function NavLinks({ links, currentId, onNavigate }: NavLinksProps) {\n  const [hoveredId, setHoveredId] = useState<string | null>(null);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const highlightTransition = highlightTransitionOf(shouldReduceMotion);\n\n  function clearHover() {\n    setHoveredId(null);\n  }\n\n  return (\n    <nav aria-label='Main' className='hidden md:block'>\n      <ul className='flex items-center' onPointerLeave={clearHover}>\n        {links.map((link) => {\n          const isHovered = hoveredId === link.id;\n          const isCurrent = currentId === link.id;\n\n          function highlight() {\n            setHoveredId(link.id);\n          }\n\n          function navigate() {\n            onNavigate(link.id);\n          }\n\n          return (\n            <li key={link.id}>\n              <a\n                href={link.href}\n                aria-current={currentAttributeOf(isCurrent)}\n                onPointerEnter={highlight}\n                onFocus={highlight}\n                onBlur={clearHover}\n                onClick={navigate}\n                className='text-muted-foreground hover:text-foreground aria-[current=page]:text-foreground focus-visible:ring-ring/25 relative inline-flex h-8 items-center rounded-full px-3 text-[13px] font-medium transition-colors outline-none focus-visible:ring-[3px]'\n              >\n                <AnimatePresence>\n                  {isHovered && (\n                    <motion.span\n                      layoutId='headers-02-highlight'\n                      aria-hidden='true'\n                      className='bg-foreground/5 absolute inset-0 rounded-full'\n                      initial={{ opacity: 0 }}\n                      animate={{ opacity: 1 }}\n                      exit={{ opacity: 0 }}\n                      transition={highlightTransition}\n                    />\n                  )}\n                </AnimatePresence>\n                <span className='relative'>{link.label}</span>\n              </a>\n            </li>\n          );\n        })}\n      </ul>\n    </nav>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/headers-02/nav-links.tsx"
    },
    {
      "path": "registry/ndeko/blocks/headers/headers-02/mobile-sheet.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { MenuIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { SelectedMark } from '@/registry/ndeko/ui/selected-mark';\nimport {\n  Sheet,\n  SheetContent,\n  SheetDescription,\n  SheetFooter,\n  SheetHeader,\n  SheetTitle,\n  SheetTrigger,\n} from '@/registry/ndeko/ui/sheet';\n\nimport { FernpostMark } from './brand-mark';\nimport { type NavLink } from './data';\n\nfunction currentAttributeOf(isCurrent: boolean) {\n  if (isCurrent) {\n    return 'page' as const;\n  }\n  return undefined;\n}\n\ntype MobileSheetProps = {\n  links: NavLink[];\n  currentId: string;\n  onNavigate: (id: string) => void;\n};\n\nexport function MobileSheet({\n  links,\n  currentId,\n  onNavigate,\n}: MobileSheetProps) {\n  const [isOpen, setIsOpen] = useState(false);\n\n  function closeSheet() {\n    setIsOpen(false);\n  }\n\n  return (\n    <Sheet open={isOpen} onOpenChange={setIsOpen}>\n      <SheetTrigger\n        render={\n          <Button\n            variant='ghost'\n            size='icon'\n            className='md:hidden'\n            aria-label='Open menu'\n          />\n        }\n      >\n        <MenuIcon />\n      </SheetTrigger>\n      <SheetContent side='right'>\n        <SheetHeader>\n          <SheetTitle className='flex items-center gap-2'>\n            <FernpostMark />\n            Fernpost\n          </SheetTitle>\n          <SheetDescription>\n            Newsletters for people who write every week\n          </SheetDescription>\n        </SheetHeader>\n        <nav aria-label='Main'>\n          <ul className='flex flex-col gap-0.5'>\n            {links.map((link) => {\n              const isCurrent = currentId === link.id;\n\n              function navigate() {\n                onNavigate(link.id);\n                closeSheet();\n              }\n\n              return (\n                <li key={link.id}>\n                  <a\n                    href={link.href}\n                    aria-current={currentAttributeOf(isCurrent)}\n                    onClick={navigate}\n                    className='text-foreground hover:bg-foreground/5 aria-[current=page]:bg-foreground/5 focus-visible:ring-ring/25 flex h-11 items-center justify-between rounded-md px-3 text-base font-medium transition-colors outline-none focus-visible:ring-[3px]'\n                  >\n                    {link.label}\n                    {isCurrent && <SelectedMark />}\n                  </a>\n                </li>\n              );\n            })}\n          </ul>\n        </nav>\n        <SheetFooter>\n          <Button\n            variant='outline'\n            size='lg'\n            nativeButton={false}\n            render={<a href='#' />}\n          >\n            Sign in\n          </Button>\n          <Button size='lg' nativeButton={false} render={<a href='#' />}>\n            Start writing\n          </Button>\n        </SheetFooter>\n      </SheetContent>\n    </Sheet>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/headers-02/mobile-sheet.tsx"
    },
    {
      "path": "registry/ndeko/blocks/headers/headers-02/brand-mark.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\n\nexport function FernpostMark({ className }: { className?: string }) {\n  return (\n    <svg\n      viewBox='0 0 24 24'\n      aria-hidden='true'\n      className={cn('size-6 shrink-0', className)}\n    >\n      <rect width='24' height='24' rx='12' className='fill-primary' />\n      <path\n        d='M7 8.5h10a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1Z'\n        className='fill-white/25'\n      />\n      <path\n        d='m6.5 9 5.5 3.75L17.5 9'\n        fill='none'\n        strokeWidth='1.6'\n        strokeLinecap='round'\n        strokeLinejoin='round'\n        className='stroke-white'\n      />\n    </svg>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/headers-02/brand-mark.tsx"
    },
    {
      "path": "registry/ndeko/blocks/headers/headers-02/data.ts",
      "content": "export type NavLink = {\n  id: string;\n  label: string;\n  href: string;\n};\n\nexport const NAV_LINKS: NavLink[] = [\n  { id: 'features', label: 'Features', href: '#' },\n  { id: 'pricing', label: 'Pricing', href: '#' },\n  { id: 'changelog', label: 'Changelog', href: '#' },\n  { id: 'docs', label: 'Docs', href: '#' },\n];\n\nexport const DEFAULT_LINK_ID = 'features';\n",
      "type": "registry:component",
      "target": "components/blocks/headers-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "headers"
  ],
  "type": "registry:block"
}