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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/testimonial-spotlight) to this Pantheon Content Publisher (P1) Next.js project. One big, well-set pull quote with attribution, centered or beside a portrait.

## Steps

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

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

/**
 * Testimonial (Spotlight) — one large pull quote with the speaker's name, role and photo.
 * Centered, or with a tall portrait beside the quote. Falls back to initials with no photo.
 * Register: `TestimonialSpotlightBlock: testimonialSpotlightBlock` in puck.config.tsx.
 */

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

export type TestimonialSpotlightProps = {
  heading: string;
  headingLevel: Heading;
  quote: string;
  name: string;
  role: string;
  avatarUrl: string;
  avatarAlt: string;
  orgName: string;
  layout: "centered" | "photo";
};

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

const QuoteMark = ({ className }: { className: string }) => (
  <svg aria-hidden="true" viewBox="0 0 48 36" fill="currentColor" className={className}>
    <path d="M13.4 36C6 36 0 30.6 0 22.7 0 12.3 7.4 3.6 19.3 0l2.2 4.4c-6.7 2.6-10.6 7-11 12.3.9-.3 2-.5 3.1-.5 5.9 0 10.2 4.3 10.2 9.8 0 5.8-4.6 10-10.4 10Zm26.4 0c-7.4 0-13.4-5.4-13.4-13.3C26.4 12.3 33.8 3.6 45.7 0l2.3 4.4c-6.8 2.6-10.6 7-11.1 12.3.9-.3 2-.5 3.1-.5 6 0 10.3 4.3 10.3 9.8 0 5.8-4.7 10-10.5 10Z" />
  </svg>
);

export const testimonialSpotlightBlock: ComponentConfig<TestimonialSpotlightProps> = {
  label: "Testimonial (Spotlight)",
  fields: {
    heading: { type: "text", label: "Heading", metadata: { help: "Small label above the quote, such as \"In their words\". Leave blank to hide it." } },
    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." },
    },
    quote: { type: "textarea", label: "Quote", metadata: { help: "Keep it to two or three sentences. Blank lines start a new paragraph." } },
    name: { type: "text", label: "Name" },
    role: { type: "text", label: "Role", metadata: { help: "Such as \"Volunteer since 2019\" or \"Parent, Eastside Rec Center\"." } },
    avatarUrl: { type: "text", label: "Photo URL", metadata: { help: "Leave blank to show the person's initials instead." } },
    avatarAlt: { type: "text", label: "Photo alt text", metadata: { help: "Usually blank, since the name is right beside the photo. Describe it only if the photo adds information." } },
    orgName: { type: "text", label: "Organization", metadata: { help: "Shown as a small wordmark beside the name. Leave blank to hide it." } },
    layout: {
      type: "radio",
      label: "Layout",
      options: [
        { label: "Centered", value: "centered" },
        { label: "Photo beside quote", value: "photo" },
      ],
      metadata: { help: "\"Photo beside quote\" needs a photo. Without one, the block shows centered." },
    },
  },
  defaultProps: {
    heading: "In their words",
    headingLevel: "h2",
    quote:
      "I signed up to pull invasive honeysuckle for one Saturday. Four years later I lead the trail crew, and my kids know every heron on the creek by name. This place gave our family a second backyard.",
    name: "Danielle Okafor",
    role: "Volunteer trail crew lead",
    avatarUrl: "https://picsum.photos/seed/trailcrew/900/1100",
    avatarAlt: "",
    orgName: "Friends of Beargrass Creek",
    layout: "photo",
  },
  render: ({ heading, headingLevel, quote, name, role, avatarUrl, avatarAlt, orgName, layout }) => {
    const H = headingLevel || "h2";
    const paragraphs = (quote || "").split(/\n\s*\n/).filter((p) => p.trim());
    const split = layout === "photo" && Boolean(avatarUrl);
    const hasAttribution = Boolean(name || role || orgName);

    const quoteText = paragraphs.length ? (
      <blockquote
        className={`space-y-6 font-medium tracking-tight text-pretty text-neutral-950 ${
          split ? "text-2xl leading-snug sm:text-3xl sm:leading-snug" : "text-2xl leading-snug sm:text-3xl sm:leading-snug lg:text-4xl lg:leading-tight"
        }`}
      >
        {paragraphs.map((para, i) => (
          <p key={i}>{para}</p>
        ))}
      </blockquote>
    ) : null;

    const person = (
      <div className={split ? undefined : "text-left"}>
        {name ? <p className="text-base font-semibold text-neutral-950">{name}</p> : null}
        {role ? <p className="text-sm leading-6 text-neutral-600">{role}</p> : null}
      </div>
    );

    const org = orgName ? (
      <>
        <span aria-hidden="true" className="hidden h-8 w-px bg-neutral-300 sm:block" />
        <p className="text-xs font-semibold tracking-widest text-neutral-600 uppercase">{orgName}</p>
      </>
    ) : null;

    if (split) {
      return (
        <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
          <figure className="mx-auto grid max-w-7xl items-center gap-10 lg:grid-cols-12 lg:gap-16">
            <div className="relative lg:col-span-5">
              <div aria-hidden="true" className="absolute -inset-3 hidden rounded-3xl bg-indigo-50 sm:block lg:-inset-4 lg:translate-x-6 lg:translate-y-6" />
              <img
                src={avatarUrl}
                alt={avatarAlt || ""}
                className="relative aspect-[4/3] w-full rounded-2xl bg-neutral-100 object-cover shadow-xl ring-1 ring-neutral-900/5 sm:aspect-[3/2] lg:aspect-[4/5]"
              />
            </div>
            <div className="lg:col-span-7">
              {heading ? <H className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{heading}</H> : null}
              <QuoteMark className={`${heading ? "mt-6" : ""} h-8 w-auto text-indigo-200 sm:h-10`} />
              <div className="mt-6">{quoteText}</div>
              {hasAttribution ? (
                <figcaption className="mt-10 flex flex-col gap-4 border-t border-neutral-200 pt-6 sm:flex-row sm:items-center sm:gap-6">
                  {person}
                  {org}
                </figcaption>
              ) : null}
            </div>
          </figure>
        </section>
      );
    }

    const monogram = initials(name);
    return (
      <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <figure className="mx-auto flex max-w-4xl flex-col items-center text-center">
          {heading ? <H className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{heading}</H> : null}
          <QuoteMark className={`${heading ? "mt-6" : ""} h-8 w-auto text-indigo-200 sm:h-10`} />
          <div className="mt-8">{quoteText}</div>
          {hasAttribution ? (
            <figcaption className="mt-10 flex flex-col items-center gap-4 sm:flex-row sm:gap-6">
              {avatarUrl || monogram ? (
                <div className="flex items-center gap-4">
                  {avatarUrl ? (
                    <img src={avatarUrl} alt={avatarAlt || ""} className="size-14 shrink-0 rounded-full bg-neutral-100 object-cover ring-4 ring-indigo-50" />
                  ) : (
                    <span aria-hidden="true" className="grid size-14 shrink-0 place-items-center rounded-full bg-indigo-100 text-lg font-semibold text-indigo-800 ring-4 ring-indigo-50">
                      {monogram}
                    </span>
                  )}
                  {person}
                </div>
              ) : (
                person
              )}
              {org}
            </figcaption>
          ) : null}
        </figure>
      </section>
    );
  },
};
```
