# Add the "Testimonial Grid" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/testimonial-grid) to this Pantheon Content Publisher (P1) Next.js project. Masonry wall of short quotes with names, roles and photos, falling back to initials when there's no photo.

## Steps

1. Create `components/puck/testimonial-grid-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 { testimonialGridBlock } from "./components/puck/testimonial-grid-block";`
3. Register it under `components` as `TestimonialGridBlock: testimonialGridBlock`.
4. Add `"TestimonialGridBlock"` 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/testimonial-grid-block.tsx`

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

/**
 * Testimonial Grid — a masonry wall of short quotes with name, role and photo (initials when
 * there's no photo). Built on CSS columns, so cards of any length pack without gaps.
 * Register: `TestimonialGridBlock: testimonialGridBlock` in puck.config.tsx.
 */

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

type Testimonial = { quote: string; name: string; role: string; avatarUrl: string; avatarAlt: string };

export type TestimonialGridProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  testimonials: Testimonial[];
  highlightFirst: "yes" | "no";
};

function initials(name?: string) {
  return (name || "")
    .trim()
    .split(/\s+/)
    .filter(Boolean)
    .map((part) => part[0])
    .slice(0, 2)
    .join("")
    .toUpperCase();
}

export const testimonialGridBlock: ComponentConfig<TestimonialGridProps> = {
  label: "Testimonial Grid",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. Leave blank to hide it." } },
    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." } },
    testimonials: {
      type: "array",
      label: "Testimonials",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.name?.slice(0, 48) || item?.quote?.slice(0, 48) || "Testimonial",
      defaultItemProps: { quote: "A sentence or two in the person's own words.", name: "Full name", role: "", avatarUrl: "", avatarAlt: "" },
      arrayFields: {
        quote: { type: "textarea", label: "Quote", metadata: { help: "Short works best here: one to three sentences. Mix lengths for a livelier wall." } },
        name: { type: "text", label: "Name" },
        role: { type: "text", label: "Role", metadata: { help: "Such as \"Parent, Westside branch\" or \"Volunteer since 2021\"." } },
        avatarUrl: { type: "text", label: "Photo URL", metadata: { help: "Square photos work best. Leave blank to show initials." } },
        avatarAlt: { type: "text", label: "Photo alt text", metadata: { help: "Usually blank, since the name sits beside the photo." } },
      },
    },
    highlightFirst: {
      type: "radio",
      label: "Highlight first quote",
      options: [
        { label: "Yes", value: "yes" },
        { label: "No", value: "no" },
      ],
      metadata: { help: "Gives the first card a solid accent background to anchor the wall." },
    },
  },
  defaultProps: {
    eyebrow: "Reader voices",
    heading: "What families say about Saturday Story Club",
    headingLevel: "h2",
    intro: "We ask every family the same question at the end of the season: what changed? These are a few of the answers.",
    highlightFirst: "yes",
    testimonials: [
      {
        quote: "My son used to hide when it was his turn to read aloud. Last week he read the whole picture book to his grandmother, voices and all.",
        name: "Rosa Delgado",
        role: "Parent, Westside branch",
        avatarUrl: "https://picsum.photos/seed/rosa-parent/160/160",
        avatarAlt: "",
      },
      { quote: "Best two hours of my week, every week.", name: "Marcus Bell", role: "Volunteer reading buddy", avatarUrl: "", avatarAlt: "" },
      {
        quote: "The librarians remembered my daughter's name on the second visit. That's the whole reason we kept coming back.",
        name: "Thu Nguyen",
        role: "Parent, Eastbank branch",
        avatarUrl: "https://picsum.photos/seed/thu-parent/160/160",
        avatarAlt: "",
      },
      {
        quote: "I joined to help kids read. I didn't expect to make friends with three other grandparents who now carpool with me.",
        name: "Walter Price",
        role: "Volunteer since 2021",
        avatarUrl: "https://picsum.photos/seed/walter-volunteer/160/160",
        avatarAlt: "",
      },
      {
        quote: "Free, close to home, and the books come home with us. We'd never had a shelf of our own before.",
        name: "Amina Yusuf",
        role: "Parent of two",
        avatarUrl: "",
        avatarAlt: "",
      },
      {
        quote: "As a second-grade teacher, I can pick out the Story Club kids in September. They raise their hands.",
        name: "Jen Kowalski",
        role: "Teacher, Hillcrest Elementary",
        avatarUrl: "https://picsum.photos/seed/jen-teacher/160/160",
        avatarAlt: "",
      },
      { quote: "I liked the dragon book the most. And the snack.", name: "Leo, age 7", role: "Story Club member", avatarUrl: "", avatarAlt: "" },
    ],
  },
  render: ({ eyebrow, heading, headingLevel, intro, testimonials, highlightFirst }) => {
    const H = headingLevel || "h2";
    const list = (testimonials ?? []).filter((t) => t?.quote);
    const hasHeader = Boolean(eyebrow || heading || intro);
    return (
      <section className="bg-neutral-50 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-7xl">
          {hasHeader ? (
            <div className="max-w-2xl">
              {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{eyebrow}</p> : null}
              {heading ? <H className={`${eyebrow ? "mt-3" : ""} 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}

          {list.length > 0 ? (
            <ul role="list" className={`${hasHeader ? "mt-12 sm:mt-16" : ""} columns-1 gap-6 sm:columns-2 lg:columns-3`}>
              {list.map((t, i) => {
                const accent = i === 0 && highlightFirst !== "no";
                const monogram = initials(t.name);
                return (
                  <li key={`${t.name}-${i}`} className="mb-6 break-inside-avoid">
                    <figure
                      className={`rounded-2xl p-6 sm:p-7 ${
                        accent ? "bg-indigo-700 text-white shadow-lg shadow-indigo-900/20" : "bg-white ring-1 ring-neutral-950/5 shadow-xs"
                      }`}
                    >
                      <svg aria-hidden="true" viewBox="0 0 24 18" fill="currentColor" className={`h-4 w-auto ${accent ? "text-indigo-300" : "text-indigo-200"}`}>
                        <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>
                      <blockquote className={`mt-4 leading-7 text-pretty ${accent ? "text-lg font-medium text-white" : "text-base text-neutral-800"}`}>
                        <p>{t.quote}</p>
                      </blockquote>
                      {t.name || t.role ? (
                        <figcaption className="mt-6 flex items-center gap-3">
                          {t.avatarUrl ? (
                            <img src={t.avatarUrl} alt={t.avatarAlt || ""} className="size-10 shrink-0 rounded-full bg-neutral-100 object-cover" />
                          ) : monogram ? (
                            <span
                              aria-hidden="true"
                              className={`grid size-10 shrink-0 place-items-center rounded-full text-sm font-semibold ${
                                accent ? "bg-indigo-500 text-white" : "bg-indigo-50 text-indigo-800"
                              }`}
                            >
                              {monogram}
                            </span>
                          ) : null}
                          <div className="min-w-0">
                            {t.name ? <p className={`text-sm font-semibold ${accent ? "text-white" : "text-neutral-950"}`}>{t.name}</p> : null}
                            {t.role ? <p className={`text-sm leading-5 ${accent ? "text-indigo-100" : "text-neutral-600"}`}>{t.role}</p> : null}
                          </div>
                        </figcaption>
                      ) : null}
                    </figure>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
