{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "heroes-02",
  "title": "Centered hero with a live board",
  "description": "A centred title above a planning board drawn from primitives, where one card keeps travelling across the lanes and a rule reacts when it lands in Done.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/kbd.json",
    "https://ui.ndekocode.dev/r/switch.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/heroes/heroes-02/index.tsx",
      "content": "import { ArrowRightIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { BoardStage } from './board-stage';\nimport { HERO } from './data';\n\nexport default function Heroes02() {\n  return (\n    <section className='px-4 pt-16 pb-12 sm:px-6 sm:pt-24 sm:pb-16 lg:px-8'>\n      <div className='mx-auto flex max-w-3xl flex-col items-center gap-5 text-center'>\n        <p className='text-primary-ink text-xs font-medium'>{HERO.eyebrow}</p>\n        <h1 className='text-4xl font-semibold text-balance sm:text-5xl'>\n          {HERO.title}\n        </h1>\n        <p className='text-muted-foreground max-w-xl text-base text-pretty'>\n          {HERO.description}\n        </p>\n        <div className='flex flex-wrap justify-center gap-2 pt-1'>\n          <Button size='lg' nativeButton={false} render={<a href='#' />}>\n            {HERO.primaryAction}\n            <ArrowRightIcon />\n          </Button>\n          <Button\n            size='lg'\n            variant='outline'\n            nativeButton={false}\n            render={<a href='#' />}\n          >\n            {HERO.secondaryAction}\n          </Button>\n        </div>\n      </div>\n      <div className='mx-auto mt-12 max-w-5xl sm:mt-16'>\n        <BoardStage />\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-02/board-stage.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  LayoutGroup,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useEffect, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { LayoutGridIcon, ZapIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\nimport { Switch } from '@/registry/ndeko/ui/switch';\n\nimport {\n  BOARD,\n  type BoardCard,\n  LANES,\n  MOVING_CARD,\n  PEOPLE,\n  type Person,\n  RULE,\n} from './data';\n\nconst MOVE_INTERVAL_MS = 2800;\n\nconst DONE_LANE_INDEX = LANES.length - 1;\n\nconst CARD_SPRING: Transition = { type: 'spring', bounce: 0.12, duration: 0.7 };\n\nconst INSTANT: Transition = { duration: 0 };\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst SWAP_VARIANTS: Variants = {\n  enter: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nfunction nextLaneIndexOf(index: number) {\n  const next = index + 1;\n  return next % LANES.length;\n}\n\nfunction cardTransitionOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return CARD_SPRING;\n}\n\nfunction swapVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SWAP_VARIANTS;\n}\n\nfunction laneCountOf(cardCount: number, holdsMovingCard: boolean) {\n  if (holdsMovingCard) {\n    return cardCount + 1;\n  }\n  return cardCount;\n}\n\nfunction ruleStatusOf(hasRuleRun: boolean) {\n  if (hasRuleRun) {\n    return RULE.done;\n  }\n  return RULE.waiting;\n}\n\nfunction PersonAvatar({\n  person,\n  className,\n}: {\n  person: Person;\n  className?: string;\n}) {\n  return (\n    <Avatar\n      className={className}\n      seed={person.name}\n      role='img'\n      aria-label={person.name}\n    />\n  );\n}\n\nfunction BoardCardView({\n  card,\n  isMoving = false,\n}: {\n  card: BoardCard;\n  isMoving?: boolean;\n}) {\n  return (\n    <div\n      className={cn(\n        'bg-card dark:bg-foreground/[0.05] flex flex-col gap-2 rounded-lg p-2 shadow-[0_1px_2px_rgb(0_0_0/0.06)] sm:p-2.5',\n        isMoving &&\n          'hairline-ring ring-primary/45 shadow-[0_10px_24px_-10px_rgb(0_0_0/0.22)]'\n      )}\n    >\n      <p className='line-clamp-2 text-xs leading-snug font-medium sm:text-[13px]'>\n        {card.title}\n      </p>\n      <div className='flex items-center justify-between gap-1'>\n        <Badge variant='secondary' className='text-muted-foreground'>\n          {card.label}\n        </Badge>\n        <PersonAvatar\n          person={card.owner}\n          className='hidden size-5 sm:inline-flex'\n        />\n      </div>\n    </div>\n  );\n}\n\nfunction BoardHeader() {\n  return (\n    <div className='flex items-center gap-2.5 px-3 pt-3 sm:px-4 sm:pt-4'>\n      <span className='gem-plate flex size-6 items-center justify-center rounded-md [--gem:var(--primary)]'>\n        <LayoutGridIcon className='size-3.5' />\n      </span>\n      <p className='text-sm font-medium'>{BOARD.title}</p>\n      <Badge\n        variant='secondary'\n        className='text-muted-foreground hidden sm:inline-flex'\n      >\n        {BOARD.week}\n      </Badge>\n      <div className='ms-auto flex -space-x-1.5'>\n        {PEOPLE.map((person) => (\n          <PersonAvatar\n            key={person.name}\n            person={person}\n            className='ring-card size-6 ring-2'\n          />\n        ))}\n      </div>\n    </div>\n  );\n}\n\nfunction RuleCard({ hasRuleRun }: { hasRuleRun: boolean }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const status = ruleStatusOf(hasRuleRun);\n  const swapVariants = swapVariantsOf(shouldReduceMotion);\n\n  return (\n    <div className='surface-raised motion-safe:animate-float absolute right-4 -bottom-6 hidden w-64 items-center gap-3 rounded-xl p-3 sm:flex lg:right-8'>\n      <span className='keycap-3d text-muted-foreground flex size-8 shrink-0 items-center justify-center rounded-lg'>\n        <ZapIcon />\n      </span>\n      <div className='flex min-w-0 flex-1 flex-col gap-0.5'>\n        <p className='truncate text-[13px] font-medium'>{RULE.trigger}</p>\n        <AnimatePresence mode='popLayout' initial={false}>\n          <motion.p\n            key={status}\n            className='text-muted-foreground truncate text-xs'\n            variants={swapVariants}\n            initial='enter'\n            animate='visible'\n            exit='exit'\n            transition={SWAP_TRANSITION}\n          >\n            {status}\n          </motion.p>\n        </AnimatePresence>\n      </div>\n      <Switch defaultChecked aria-label='Rule is on' />\n    </div>\n  );\n}\n\nexport function BoardStage() {\n  const [movingLaneIndex, setMovingLaneIndex] = useState(0);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const cardTransition = cardTransitionOf(shouldReduceMotion);\n  const hasRuleRun = movingLaneIndex === DONE_LANE_INDEX;\n\n  useEffect(() => {\n    if (shouldReduceMotion) {\n      return;\n    }\n    const interval = window.setInterval(() => {\n      setMovingLaneIndex(nextLaneIndexOf);\n    }, MOVE_INTERVAL_MS);\n    return () => window.clearInterval(interval);\n  }, [shouldReduceMotion]);\n\n  return (\n    <div\n      inert\n      aria-hidden='true'\n      className='bg-foreground/[0.025] relative rounded-2xl p-3 pb-10 sm:p-6 sm:pb-12'\n    >\n      <div className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex flex-col gap-3 rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_32px_-16px_rgb(0_0_0/0.12)] sm:gap-4'>\n        <BoardHeader />\n        <LayoutGroup id='heroes-02-board'>\n          <div className='grid grid-cols-3 gap-2 px-2 pb-2 sm:gap-3 sm:px-4 sm:pb-4'>\n            {LANES.map((lane, index) => {\n              const holdsMovingCard = index === movingLaneIndex;\n              const count = laneCountOf(lane.cards.length, holdsMovingCard);\n\n              return (\n                <div\n                  key={lane.id}\n                  className='bg-foreground/[0.03] flex min-w-0 flex-col gap-2 rounded-lg p-1.5 sm:p-2'\n                >\n                  <div className='flex items-center justify-between gap-1 px-1 pt-0.5'>\n                    <span className='truncate text-xs font-medium'>\n                      {lane.title}\n                    </span>\n                    <Kbd>{count}</Kbd>\n                  </div>\n                  {holdsMovingCard && (\n                    <motion.div\n                      layoutId='heroes-02-moving-card'\n                      transition={cardTransition}\n                      className='relative z-10'\n                    >\n                      <BoardCardView card={MOVING_CARD} isMoving />\n                    </motion.div>\n                  )}\n                  {lane.cards.map((card) => (\n                    <motion.div\n                      key={card.id}\n                      layout='position'\n                      transition={cardTransition}\n                    >\n                      <BoardCardView card={card} />\n                    </motion.div>\n                  ))}\n                </div>\n              );\n            })}\n          </div>\n        </LayoutGroup>\n      </div>\n      <RuleCard hasRuleRun={hasRuleRun} />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-02/board-stage.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-02/data.ts",
      "content": "export type Person = {\n  name: string;\n};\n\nexport type BoardCard = {\n  id: string;\n  title: string;\n  label: string;\n  owner: Person;\n};\n\nexport type Lane = {\n  id: string;\n  title: string;\n  cards: BoardCard[];\n};\n\nconst AMA: Person = { name: 'Ama Mensah' };\nconst JONAS: Person = { name: 'Jonas Berg' };\nconst LUCIA: Person = { name: 'Lucia Ferro' };\nconst DEV: Person = { name: 'Dev Raman' };\n\nexport const PEOPLE: Person[] = [AMA, JONAS, LUCIA, DEV];\n\nexport const LANES: Lane[] = [\n  {\n    id: 'todo',\n    title: 'To do',\n    cards: [\n      {\n        id: 'pricing-copy',\n        title: 'Pricing page copy',\n        label: 'Copy',\n        owner: LUCIA,\n      },\n      {\n        id: 'launch-photos',\n        title: 'Book launch photos',\n        label: 'Design',\n        owner: JONAS,\n      },\n    ],\n  },\n  {\n    id: 'doing',\n    title: 'In progress',\n    cards: [\n      {\n        id: 'onboarding',\n        title: 'Onboarding checklist',\n        label: 'Product',\n        owner: DEV,\n      },\n    ],\n  },\n  {\n    id: 'done',\n    title: 'Done',\n    cards: [\n      {\n        id: 'beta-notes',\n        title: 'Beta feedback notes',\n        label: 'Research',\n        owner: AMA,\n      },\n    ],\n  },\n];\n\nexport const MOVING_CARD: BoardCard = {\n  id: 'launch-email',\n  title: 'Write the launch email',\n  label: 'Copy',\n  owner: AMA,\n};\n\nexport const BOARD = {\n  title: 'Launch plan',\n  week: 'Week 46',\n};\n\nexport const RULE = {\n  trigger: 'When a card reaches Done',\n  waiting: 'Waiting for the next card',\n  done: 'Posted in #launch',\n};\n\nexport const HERO = {\n  eyebrow: 'Boards, timelines and reports',\n  title: 'Plan the week on one board, with every card, date and owner',\n  description:\n    'Lanes, timelines and reports read the same cards, so Monday planning fits in one meeting instead of three threads.',\n  primaryAction: 'Start planning',\n  secondaryAction: 'Browse templates',\n};\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "heroes"
  ],
  "type": "registry:block"
}