{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "blog-section",
  "title": "Blog Section",
  "description": "A blog section with a featured post card, category tabs with a sliding pill, an editorial list of posts where a thumbnail follows the cursor over each row, and a Show more button that reveals posts in pages.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/blog-section/blog-section.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useMotionValue, useReducedMotion, useSpring } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface BlogPost {\n  id: string;\n  title: string;\n  excerpt?: string;\n  category: string;\n  /** Shown as written, e.g. \"Oct 30, 2026\". */\n  date: string;\n  readMinutes?: number;\n  image?: string;\n  author?: { name: string; avatar?: string };\n  href?: string;\n}\n\nexport interface BlogSectionProps {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  /** The first post is featured; the rest go in the list. */\n  posts?: BlogPost[];\n  /** Posts shown in the list before \"Show more\". */\n  pageSize?: number;\n  /** Category tabs built from the posts. */\n  categories?: boolean;\n  /** A thumbnail follows the cursor over list rows on wide screens. */\n  hoverPreview?: boolean;\n  viewAllHref?: string | null;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.6)\", faint: \"rgba(245,244,241,0.38)\", border: \"rgba(255,255,255,0.1)\", chip: \"rgba(255,255,255,0.05)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", card: \"#111111\", ring: \"rgba(245,244,241,0.6)\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.6)\", faint: \"rgba(10,10,10,0.4)\", border: \"rgba(10,10,10,0.1)\", chip: \"rgba(10,10,10,0.04)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", card: \"#FFFFFF\", ring: \"rgba(10,10,10,0.5)\" },\n};\n\nconst DEFAULT_POSTS: BlogPost[] = [\n  { id: \"planning\", title: \"How we cut our planning meetings in half\", excerpt: \"We replaced the weekly status call with a two-minute written update. Here is the template, the rules and what we learned in the first quarter.\", category: \"Product\", date: \"Oct 30, 2026\", readMinutes: 7, image: \"/demo/1.webp\", author: { name: \"Leyla Aksoy\", avatar: \"/demo/49.webp\" }, href: \"#\" },\n  { id: \"spec\", title: \"A spec template people actually read\", excerpt: \"Problem, bet, done when. Three headings that turned our 12-page specs into one.\", category: \"Product\", date: \"Oct 23, 2026\", readMinutes: 5, image: \"/demo/6.webp\", author: { name: \"Kenji Mori\", avatar: \"/demo/42.webp\" }, href: \"#\" },\n  { id: \"motion\", title: \"Designing motion that respects reduced-motion settings\", excerpt: \"Every animation in our app has a still version. How we design both at once.\", category: \"Design\", date: \"Oct 16, 2026\", readMinutes: 6, image: \"/demo/29.webp\", author: { name: \"Ines Duarte\", avatar: \"/demo/41.webp\" }, href: \"#\" },\n  { id: \"sync\", title: \"Building offline sync without losing a word\", excerpt: \"CRDTs, conflict rules and the bug that took us three weeks to find.\", category: \"Engineering\", date: \"Oct 9, 2026\", readMinutes: 11, image: \"/demo/34.webp\", author: { name: \"Theo Mensah\", avatar: \"/demo/47.webp\" }, href: \"#\" },\n  { id: \"hiring\", title: \"Our interview process, written down\", excerpt: \"Five steps, a paid task and the pay band before the first call.\", category: \"Company\", date: \"Oct 2, 2026\", readMinutes: 4, image: \"/demo/9.webp\", author: { name: \"Kenji Mori\", avatar: \"/demo/42.webp\" }, href: \"#\" },\n  { id: \"roadmaps\", title: \"Roadmaps without dates: a field guide\", excerpt: \"Now, next, later works until it doesn't. When to add dates back.\", category: \"Product\", date: \"Sep 25, 2026\", readMinutes: 8, image: \"/demo/26.webp\", author: { name: \"Leyla Aksoy\", avatar: \"/demo/49.webp\" }, href: \"#\" },\n  { id: \"tokens\", title: \"Design tokens that survive a rebrand\", excerpt: \"Name colours by job, not by hue. What that saved us last spring.\", category: \"Design\", date: \"Sep 18, 2026\", readMinutes: 6, image: \"/demo/33.webp\", author: { name: \"Ines Duarte\", avatar: \"/demo/41.webp\" }, href: \"#\" },\n  { id: \"perf\", title: \"Typing under 16 ms on a 10,000-block doc\", excerpt: \"Virtualisation, batching and the profiler screenshots to prove it.\", category: \"Engineering\", date: \"Sep 11, 2026\", readMinutes: 9, image: \"/demo/21.webp\", author: { name: \"Theo Mensah\", avatar: \"/demo/47.webp\" }, href: \"#\" },\n];\n\nexport function BlogSection({\n  eyebrow = \"Blog\",\n  title = \"Notes from the team\",\n  description = \"What we learn building a planning tool: product, design, engineering and how we work.\",\n  posts = DEFAULT_POSTS,\n  pageSize = 4,\n  categories = true,\n  hoverPreview = true,\n  viewAllHref = \"#\",\n  theme = \"dark\",\n  className,\n}: BlogSectionProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [cat, setCat] = React.useState(\"All\");\n  const [shown, setShown] = React.useState(pageSize);\n  const [hover, setHover] = React.useState<string | null>(null);\n  const listRef = React.useRef<HTMLDivElement>(null);\n  const x = useMotionValue(0);\n  const y = useMotionValue(0);\n  const sx = useSpring(x, { stiffness: 300, damping: 30 });\n  const sy = useSpring(y, { stiffness: 300, damping: 30 });\n\n  const [featured, ...rest] = posts;\n  const cats = [\"All\", ...Array.from(new Set(rest.map((r) => r.category)))];\n  const filtered = rest.filter((r) => cat === \"All\" || r.category === cat);\n  const list = filtered.slice(0, shown);\n  const hovered = rest.find((r) => r.id === hover);\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.bg } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n\n  const showMore = () => {\n    const first = shown;\n    setShown((n) => n + pageSize);\n    // Move focus to the first new row for keyboard users.\n    setTimeout(() => listRef.current?.querySelectorAll<HTMLElement>(\"li a\")[first]?.focus(), 50);\n  };\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto max-w-6xl px-6 py-20 @[640px]:py-24\">\n        <div className=\"flex flex-col gap-4 @[760px]:flex-row @[760px]:items-end @[760px]:justify-between\">\n          <div>\n            {eyebrow && <p className=\"m-0 text-[13px] font-medium tracking-[0.12em] uppercase\" style={{ color: p.faint }}>{eyebrow}</p>}\n            <h2 className=\"mt-3 mb-0 text-[32px] leading-[1.1] font-semibold tracking-[-0.03em] @[640px]:text-[44px]\">{title}</h2>\n            {description && <p className=\"mt-3 mb-0 max-w-[480px] text-[16px] leading-[1.6]\" style={{ color: p.muted }}>{description}</p>}\n          </div>\n          {viewAllHref && (\n            <a href={viewAllHref} className={cn(\"shrink-0 self-start rounded text-[14px] font-medium no-underline hover:underline hover:underline-offset-4 @[760px]:self-end\", focus)} style={{ color: p.text, ...ring }}>\n              All posts →\n            </a>\n          )}\n        </div>\n\n        {featured && (\n          <motion.a\n            href={featured.href ?? \"#\"}\n            initial={reduce ? false : { opacity: 0, y: 16 }}\n            whileInView={{ opacity: 1, y: 0 }}\n            viewport={{ once: true, amount: 0.3 }}\n            transition={{ duration: 0.5 }}\n            className={cn(\"group mt-10 grid overflow-hidden rounded-2xl border no-underline @[760px]:grid-cols-[1.2fr_1fr]\", focus)}\n            style={{ borderColor: p.border, background: p.card, color: p.text, ...ring }}\n          >\n            {featured.image && (\n              <span className=\"relative block aspect-[16/10] overflow-hidden @[760px]:aspect-auto @[760px]:min-h-[340px]\">\n                {/* eslint-disable-next-line @next/next/no-img-element */}\n                <img src={featured.image} alt=\"\" className=\"absolute inset-0 h-full w-full object-cover transition-transform duration-700 group-hover:scale-[1.04]\" />\n              </span>\n            )}\n            <span className=\"flex flex-col p-6 @[640px]:p-8\">\n              <span className=\"flex items-center gap-2 text-[12.5px]\" style={{ color: p.faint }}>\n                <span className=\"rounded-full px-2.5 py-1 text-[11.5px] font-semibold\" style={{ background: p.on, color: p.onText }}>\n                  Featured\n                </span>\n                {featured.category} · {featured.date}\n              </span>\n              <span className=\"mt-5 block text-[24px] leading-[1.2] font-semibold tracking-[-0.02em] @[640px]:text-[30px]\">{featured.title}</span>\n              {featured.excerpt && (\n                <span className=\"mt-3 block text-[15px] leading-[1.6]\" style={{ color: p.muted }}>\n                  {featured.excerpt}\n                </span>\n              )}\n              <span className=\"mt-auto flex items-center justify-between gap-3 pt-8\">\n                {featured.author && (\n                  <span className=\"flex items-center gap-2.5 text-[13.5px]\">\n                    {featured.author.avatar && (\n                      // eslint-disable-next-line @next/next/no-img-element\n                      <img src={featured.author.avatar} alt=\"\" width={30} height={30} className=\"h-[30px] w-[30px] rounded-full object-cover\" />\n                    )}\n                    <span>\n                      {featured.author.name}\n                      {featured.readMinutes && <span style={{ color: p.faint }}> · {featured.readMinutes} min read</span>}\n                    </span>\n                  </span>\n                )}\n                <span aria-hidden=\"true\" className=\"flex h-9 w-9 items-center justify-center rounded-full border transition-transform group-hover:translate-x-1\" style={{ borderColor: p.border }}>\n                  →\n                </span>\n              </span>\n            </span>\n          </motion.a>\n        )}\n\n        {rest.length > 0 && (\n          <div className=\"mt-12\">\n            {categories && cats.length > 2 && (\n              <div role=\"group\" aria-label=\"Filter posts\" className=\"-mx-6 flex gap-1.5 overflow-x-auto px-6 pb-1 [scrollbar-width:none] @[640px]:mx-0 @[640px]:px-0 [&::-webkit-scrollbar]:hidden\">\n                {cats.map((c) => {\n                  const on = cat === c;\n                  return (\n                    <button\n                      key={c}\n                      type=\"button\"\n                      aria-pressed={on}\n                      onClick={() => {\n                        setCat(c);\n                        setShown(pageSize);\n                      }}\n                      className={cn(\"relative h-9 shrink-0 cursor-pointer rounded-full border px-3.5 text-[13px] font-medium whitespace-nowrap\", focus)}\n                      style={{ borderColor: on ? p.on : p.border, background: \"transparent\", color: on ? p.onText : p.muted, ...ring }}\n                    >\n                      {on && <motion.span layoutId={`${uid}-cat`} className=\"absolute inset-0 rounded-full\" style={{ background: p.on }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 420, damping: 34 }} />}\n                      <span className=\"relative\">{c}</span>\n                    </button>\n                  );\n                })}\n              </div>\n            )}\n\n            <div\n              ref={listRef}\n              className=\"relative mt-4\"\n              onPointerMove={(e) => {\n                if (!listRef.current) return;\n                const r = listRef.current.getBoundingClientRect();\n                x.set(e.clientX - r.left);\n                y.set(e.clientY - r.top);\n              }}\n              onPointerLeave={() => setHover(null)}\n            >\n              <ul className=\"m-0 list-none border-t p-0\" style={{ borderColor: p.border }}>\n                <AnimatePresence initial={false}>\n                  {list.map((post) => (\n                    <motion.li key={post.id} layout={!reduce} initial={reduce ? false : { opacity: 0, height: 0 }} animate={{ opacity: 1, height: \"auto\" }} exit={reduce ? undefined : { opacity: 0, height: 0 }} transition={{ duration: 0.25 }} className=\"overflow-hidden border-b\" style={{ borderColor: p.border }}>\n                      <a\n                        href={post.href ?? \"#\"}\n                        onPointerEnter={() => setHover(post.id)}\n                        className={cn(\"group grid grid-cols-[72px_1fr] items-center gap-4 py-5 no-underline @[760px]:grid-cols-[110px_1fr_auto] @[760px]:gap-8\", focus)}\n                        style={{ color: p.text, ...ring }}\n                      >\n                        <span className=\"text-[12.5px] tabular-nums\" style={{ color: p.faint }}>\n                          {post.date.replace(/, \\d{4}$/, \"\")}\n                        </span>\n                        <span className=\"min-w-0\">\n                          <span className=\"block text-[17px] leading-[1.35] font-medium tracking-[-0.01em] transition-transform duration-300 group-hover:translate-x-1 @[640px]:text-[19px]\">{post.title}</span>\n                          <span className=\"mt-1 block text-[13px]\" style={{ color: p.faint }}>\n                            {post.category}\n                            {post.readMinutes ? ` · ${post.readMinutes} min read` : \"\"}\n                            {post.author ? ` · ${post.author.name}` : \"\"}\n                          </span>\n                        </span>\n                        <span aria-hidden=\"true\" className=\"hidden h-9 w-9 items-center justify-center rounded-full border opacity-0 transition-opacity group-hover:opacity-100 @[760px]:flex\" style={{ borderColor: p.border }}>\n                          ↗\n                        </span>\n                      </a>\n                    </motion.li>\n                  ))}\n                </AnimatePresence>\n              </ul>\n\n              {hoverPreview && !reduce && (\n                <motion.div aria-hidden=\"true\" className=\"pointer-events-none absolute top-0 left-0 z-10 hidden @[860px]:block\" style={{ x: sx, y: sy }}>\n                  <AnimatePresence>\n                    {hovered?.image && (\n                      <motion.div key={hovered.id} initial={{ opacity: 0, scale: 0.85, rotate: -4 }} animate={{ opacity: 1, scale: 1, rotate: -2 }} exit={{ opacity: 0, scale: 0.9 }} transition={{ type: \"spring\", stiffness: 300, damping: 24 }} className=\"absolute top-0 left-0 h-[150px] w-[220px] -translate-y-1/2 translate-x-6 overflow-hidden rounded-xl shadow-[0_20px_50px_-15px_rgba(0,0,0,0.6)]\">\n                        {/* eslint-disable-next-line @next/next/no-img-element */}\n                        <img src={hovered.image} alt=\"\" className=\"h-full w-full object-cover\" />\n                      </motion.div>\n                    )}\n                  </AnimatePresence>\n                </motion.div>\n              )}\n            </div>\n\n            <div className=\"mt-6 flex items-center justify-between gap-4\">\n              <p className=\"m-0 text-[13px] tabular-nums\" style={{ color: p.faint }} aria-live=\"polite\">\n                {filtered.length === 0 ? \"No posts in this category yet.\" : `Showing ${list.length} of ${filtered.length}`}\n              </p>\n              {list.length < filtered.length && (\n                <button type=\"button\" onClick={showMore} className={cn(\"h-10 cursor-pointer rounded-full border px-4 text-[14px] font-medium\", focus)} style={{ borderColor: p.border, background: \"transparent\", color: p.text, ...ring }}>\n                  Show more\n                </button>\n              )}\n            </div>\n          </div>\n        )}\n      </div>\n    </section>\n  );\n}\n\nexport default BlogSection;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}