{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "logos-grid",
  "type": "registry:block",
  "title": "Logos, grid",
  "description": "A hairline grid of up to 48 logo cells. Each cell shows its image, or the name set as a wordmark while there is no image.",
  "categories": [
    "logos"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/button.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/kit-c-proof.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/logos-grid/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/logos-grid/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, t } from '../_shared/schema';\n\n// KB-178: a logo needs no name (its picture alt names it), may link out (href), and the wall holds up to 48.\nconst schema = z.object({\n  title: t(80),\n  description: t(300),\n  // Optional action at the end of the heading row: with it the heading sits left and the action right (stacked on a phone), instead of the centered heading.\n  action: link.partial().optional(),\n  // Optional: 6 logos per row from the widest container (default tops out at 4).\n  wide: z.boolean().optional(),\n  logos: z.array(z.object({ name: t(40).optional(), media, href: t(300).optional() })).min(2).max(48),\n});\n\nconst logo = (name: string) => ({ name, media: { src: '', alt: name } });\n\nexport const spec = defineSpec({\n  type: 'logos-grid',\n  aliases: ['logo-cloud/grid'],\n  sourceRuns: ['rmwj0wvt5d9c0e6'],\n  name: 'Logos, grid',\n  category: 'logos',\n  role: 'body',\n  description: 'A hairline grid of up to 48 logo cells. Each cell shows its image, or the name set as a wordmark while there is no image.',\n  schema,\n  defaults: {\n    title: 'Say who relies on you in one line',\n    description: 'Say in a sentence or two who your customers are and what they use you for.',\n    logos: ['First logo', 'Second logo', 'Third logo', 'Fourth logo', 'Fifth logo', 'Sixth logo', 'Seventh logo', 'Eighth logo'].map(logo),\n  },\n});\n"
    },
    {
      "path": "src/blocks/logos-grid/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/logos-grid/index.tsx",
      "content": "import type { ReactNode } from 'react';\nimport { Media, Text, withHeadingLevel } from '../../editing';\nimport { safeHref } from '../../ui/button';\nimport { ActionLink, Container, HAIR_CELL, HAIR_GRID, HairFrame, Opt, Section, useEditing } from '../_shared/kit';\nimport { Heading, hasImage, useHeadingId } from '../_shared/c-proof-kit';\nimport { cn } from '../../lib/utils';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\n// Names without artwork are set as wordmarks in varied faces so the grid reads as logos without any client artwork.\nconst FACES = ['font-semibold tracking-tight', 'font-medium tracking-[0.18em] uppercase text-kh-small', 'font-kh-mono font-medium', 'font-bold tracking-tighter', 'font-light tracking-wide', 'font-semibold italic'];\n\n/** A cell is a link when the logo has an href (the picture's alt or the name names it). */\nfunction Cell({ href, className, children }: { href: string | undefined; className: string; children: ReactNode }) {\n  return href ? <a href={safeHref(href)} className={cn(className, 'transition-colors hover:bg-kh-surface')}>{children}</a> : <div className={className}>{children}</div>;\n}\n\nfunction LogosGrid({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const editing = useEditing();\n  return (\n    <Section labelledBy={id}>\n      <Container>\n        {props.action ? (\n          <div className=\"flex flex-col gap-6 @xl:flex-row @xl:items-end @xl:justify-between\">\n            <div>\n              <div id={id}><Opt path={['title']} value={props.title} as=\"h2\" className=\"text-kh-heading\" placeholder=\"Title\" /></div>\n              <Opt path={['description']} value={props.description} className=\"mt-3 max-w-kh-lead text-kh-small text-kh-muted\" placeholder=\"Description\" />\n            </div>\n            <ActionLink path={['action']} value={{ label: props.action.label ?? '', href: props.action.href ?? '' }} className=\"shrink-0\" />\n          </div>\n        ) : (\n          <Heading id={id} title={props.title} description={props.description} align=\"center\" />\n        )}\n        <HairFrame className={props.action ? 'mt-10' : 'mt-12'}>\n          <ul className={cn(HAIR_GRID, 'grid-cols-2 @xl:grid-cols-3', props.wide ? '@3xl:grid-cols-6' : '@3xl:grid-cols-4')}>\n            {props.logos.map((l, i) => {\n              const image = hasImage(l.media);\n              return (\n                <li key={i} className={cn(HAIR_CELL, props.action ? 'bg-kh-surface' : 'bg-kh-canvas')}>\n                  <Cell href={editing ? undefined : l.href} className=\"flex min-h-28 flex-col items-center justify-center gap-3 px-6 py-8\">\n                  {(image || editing) && (\n                    <div className=\"w-32 max-w-full\">\n                      <Media path={['logos', i, 'media']} value={l.media} ratio=\"3 / 1\" />\n                    </div>\n                  )}\n                  <Text\n                    path={['logos', i, 'name']}\n                    value={l.name ?? ''}\n                    as=\"span\"\n                    className={cn(image && !editing ? 'sr-only' : 'text-kh-heading text-kh-muted', !image && FACES[i % FACES.length])}\n                  />\n                  </Cell>\n                </li>\n              );\n            })}\n          </ul>\n        </HairFrame>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(LogosGrid);\n"
    }
  ]
}
