# Add the "Community Voices" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/community-voices) to this Pantheon Content Publisher (P1) Next.js project. Photo mosaic of neighbors with short quotes overlaid, alternating large and small tiles.

## Steps

1. Create `components/puck/community-voices-block.tsx` with the exact file contents below. If `components/puck/` doesn't exist, find the folder where this project keeps its Puck components (look at the imports in `puck.config.tsx`) and put it there.
2. In `puck.config.tsx`, import it: `import { communityVoicesBlock } from "./components/puck/community-voices-block";`
3. Register it under `components` as `CommunityVoicesBlock: communityVoicesBlock`.
4. Add `"CommunityVoicesBlock"` to the best-fitting entry in `categories` (this block's library category is "Social proof"). Create a category only if none fits.
5. Run the project's type check (usually `pnpm typecheck`) and resolve anything project-specific.
6. If `package.json` has a `sync:registry` script, tell the user it must run (or that CI will run it) before the new component appears in the P1 editor.

## Rules

- Do not add dependencies. The block is self-contained by design: one type-only import from `@puckeditor/core`, Tailwind v4 classes, no client JavaScript.
- Keep the files as-is unless the user asks for changes. The accent color is `indigo-*`; if the project has brand colors, offer to swap them with a find-and-replace on `indigo-`.
- Images are plain `imageUrl` + `imageAlt` text fields. If this project defines a P1 media-library field (search for `"p1-media"`), offer to switch to it.
- Don't change prop names in `defaultProps`. Content editors' saved pages depend on them.

## File: `components/puck/community-voices-block.tsx`

```tsx
import type { ComponentConfig } from "@puckeditor/core";

/**
 * Community Voices — a photo mosaic of neighbors with short quotes laid over each picture.
 * Every fifth tile is large and alternates sides; a tile without a photo becomes a solid
 * quote card. Register: `CommunityVoicesBlock: communityVoicesBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";

type Voice = { quote: string; name: string; place: string; imageUrl: string; imageAlt: string };

export type CommunityVoicesProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  voices: Voice[];
  ctaLabel: string;
  ctaHref: string;
};

const tileShape = (i: number) => {
  const big = i % 5 === 0;
  const flip = Math.floor(i / 5) % 2 === 1;
  if (!big) return { big, cls: "flex min-h-72 sm:min-h-80" };
  return { big, cls: `flex min-h-96 sm:col-span-2 lg:row-span-2 ${flip ? "lg:col-start-3" : ""}` };
};

export const communityVoicesBlock: ComponentConfig<CommunityVoicesProps> = {
  label: "Community Voices",
  fields: {
    heading: { type: "text", label: "Heading" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Sets the page outline for screen readers and search. The look doesn't change." },
    },
    intro: { type: "textarea", label: "Intro", metadata: { help: "Optional sentence under the heading. Leave blank to hide it." } },
    voices: {
      type: "array",
      label: "Voices",
      min: 1,
      max: 10,
      getItemSummary: (item) => item?.name?.slice(0, 48) || item?.quote?.slice(0, 48) || "Voice",
      defaultItemProps: { quote: "A short line in their own words.", name: "First name", place: "", imageUrl: "", imageAlt: "" },
      arrayFields: {
        quote: { type: "textarea", label: "Quote", metadata: { help: "Keep it under 25 words; it sits on top of the photo." } },
        name: { type: "text", label: "Name" },
        place: { type: "text", label: "Neighborhood or role", metadata: { help: "Such as \"Portland neighborhood\" or \"Member since 2019\"." } },
        imageUrl: { type: "text", label: "Photo URL", metadata: { help: "Leave blank to show this voice as a solid quote card." } },
        imageAlt: { type: "text", label: "Photo alt text", metadata: { help: "Describe the scene briefly. The quote and name are read separately." } },
      },
      metadata: { help: "Laid out in groups of five: one large tile and four small. Five or ten voices fill the mosaic evenly." },
    },
    ctaLabel: { type: "text", label: "Link text", metadata: { help: "Optional link under the mosaic, such as \"Share your story\"." } },
    ctaHref: { type: "text", label: "Link" },
  },
  defaultProps: {
    heading: "Voices from the neighborhood",
    headingLevel: "h2",
    intro: "We asked people at the new Fairview Commons what the space means to them. Here's what they told us.",
    ctaLabel: "Share your story",
    ctaHref: "#",
    voices: [
      {
        quote: "Twenty years on this block and I'd never met the family two doors down. Now our kids share a garden plot.",
        name: "Bernice",
        place: "Fairview resident since 2004",
        imageUrl: "https://picsum.photos/seed/fairview-garden/1200/1200",
        imageAlt: "Two neighbors kneel beside a raised garden bed, laughing.",
      },
      {
        quote: "The Wi-Fi is free and nobody rushes you out.",
        name: "Jalen",
        place: "High school junior",
        imageUrl: "https://picsum.photos/seed/fairview-study/800/800",
        imageAlt: "A teenager studies at a long table by a sunny window.",
      },
      {
        quote: "I teach chair yoga here on Thursdays. Nine people came the first week. Last week, thirty-one.",
        name: "Mrs. Oduya",
        place: "Volunteer instructor",
        imageUrl: "",
        imageAlt: "",
      },
      {
        quote: "It finally feels like the city built something for us.",
        name: "Hector",
        place: "Small-business owner",
        imageUrl: "https://picsum.photos/seed/fairview-market/800/800",
        imageAlt: "A vendor arranges produce at an outdoor market stall.",
      },
      {
        quote: "My grandson learned to ride his bike on that path.",
        name: "Ana",
        place: "Fairview resident",
        imageUrl: "https://picsum.photos/seed/fairview-path/800/800",
        imageAlt: "A child on a bicycle rolls down a tree-lined paved path.",
      },
    ],
  },
  render: ({ heading, headingLevel, intro, voices, ctaLabel, ctaHref }) => {
    const H = headingLevel || "h2";
    const list = (voices ?? []).filter((v) => v?.quote || v?.imageUrl);
    const hasHeader = Boolean(heading || intro);

    return (
      <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-7xl">
          {hasHeader || (ctaLabel && ctaHref) ? (
            <div className="flex flex-col gap-6 sm:flex-row sm:items-end sm:justify-between">
              {hasHeader ? (
                <div className="max-w-2xl">
                  {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
                  {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
                </div>
              ) : null}
              {ctaLabel && ctaHref ? (
                <a
                  href={ctaHref}
                  className="inline-flex min-h-11 shrink-0 items-center gap-2 self-start rounded-full px-1 text-sm font-semibold text-indigo-700 hover:text-indigo-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:self-auto"
                >
                  {ctaLabel}
                  <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-4">
                    <path fillRule="evenodd" d="M2 8a.75.75 0 0 1 .75-.75h8.69L8.22 4.03a.75.75 0 0 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06-1.06l3.22-3.22H2.75A.75.75 0 0 1 2 8Z" clipRule="evenodd" />
                  </svg>
                </a>
              ) : null}
            </div>
          ) : null}

          {list.length > 0 ? (
            <ul role="list" className={`${hasHeader ? "mt-12 sm:mt-16" : ""} grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-flow-dense lg:grid-cols-4`}>
              {list.map((v, i) => {
                const { big, cls } = tileShape(i);
                const photo = Boolean(v.imageUrl);
                return (
                  <li key={`${v.name}-${i}`} className={cls}>
                    <figure
                      className={`relative isolate flex w-full flex-col justify-end overflow-hidden rounded-2xl ${
                        photo ? "bg-neutral-800" : i % 2 ? "bg-indigo-700" : "bg-indigo-950"
                      } ${big ? "p-6 sm:p-8" : "p-5 sm:p-6"}`}
                    >
                      {photo ? (
                        <>
                          <img src={v.imageUrl} alt={v.imageAlt || ""} className="absolute inset-0 -z-10 size-full object-cover" />
                          <div aria-hidden="true" className="absolute inset-0 -z-10 bg-linear-to-t from-neutral-950/90 via-neutral-950/50 to-neutral-950/0" />
                        </>
                      ) : (
                        <svg aria-hidden="true" viewBox="0 0 24 18" fill="currentColor" className="mb-auto h-6 w-auto self-start text-indigo-300">
                          <path d="M6.7 18C3 18 0 15.3 0 11.4 0 6.2 3.7 1.8 9.6 0l1.1 2.2C7.4 3.5 5.5 5.7 5.2 8.4c.5-.2 1-.3 1.6-.3 2.9 0 5.1 2.2 5.1 4.9 0 2.9-2.3 5-5.2 5Zm12.2 0c-3.7 0-6.7-2.7-6.7-6.6 0-5.2 3.7-9.6 9.6-11.4l1.2 2.2c-3.4 1.3-5.3 3.5-5.6 6.2.5-.2 1-.3 1.6-.3 3 0 5.2 2.2 5.2 4.9 0 2.9-2.4 5-5.3 5Z" />
                        </svg>
                      )}
                      {v.quote ? (
                        <blockquote
                          className={`font-medium text-pretty text-white ${
                            big ? "text-2xl leading-snug sm:text-3xl sm:leading-snug" : photo ? "text-lg leading-snug" : "text-xl leading-snug"
                          }`}
                        >
                          <p>“{v.quote}”</p>
                        </blockquote>
                      ) : null}
                      {v.name || v.place ? (
                        <figcaption className="mt-4 text-sm leading-5">
                          {v.name ? <span className="font-semibold text-white">{v.name}</span> : null}
                          {v.name && v.place ? <span aria-hidden="true" className="text-neutral-300"> · </span> : null}
                          {v.place ? <span className="text-neutral-200">{v.place}</span> : null}
                        </figcaption>
                      ) : null}
                    </figure>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
