# Add the "Video Testimonials" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/video-testimonials) to this Pantheon Content Publisher (P1) Next.js project. Poster cards with play button and runtime badge that open each testimonial video in a new tab.

## Steps

1. Create `components/puck/video-testimonials-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 { videoTestimonialsBlock } from "./components/puck/video-testimonials-block";`
3. Register it under `components` as `VideoTestimonialsBlock: videoTestimonialsBlock`.
4. Add `"VideoTestimonialsBlock"` 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/video-testimonials-block.tsx`

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

/**
 * Video Testimonials — poster-image cards with a play button and runtime badge, each linking
 * out to the video (YouTube, Vimeo, etc.) in a new tab. No player script, no embeds.
 * Register: `VideoTestimonialsBlock: videoTestimonialsBlock` in puck.config.tsx.
 */

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

type Video = { name: string; role: string; teaser: string; posterUrl: string; posterAlt: string; videoUrl: string; duration: string };

export type VideoTestimonialsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  videos: Video[];
  style: "dark" | "light";
};

const subLevel = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;

const gridCols = (count: number) => {
  if (count <= 1) return "max-w-3xl";
  if (count === 2 || count === 4) return "sm:grid-cols-2";
  return "sm:grid-cols-2 lg:grid-cols-3";
};

export const videoTestimonialsBlock: ComponentConfig<VideoTestimonialsProps> = {
  label: "Video Testimonials",
  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." } },
    videos: {
      type: "array",
      label: "Videos",
      min: 1,
      max: 9,
      getItemSummary: (item) => [item?.name, item?.duration].filter(Boolean).join(" · ").slice(0, 48) || "Video",
      defaultItemProps: { name: "Speaker name", role: "", teaser: "", posterUrl: "", posterAlt: "", videoUrl: "", duration: "" },
      arrayFields: {
        name: { type: "text", label: "Name", metadata: { help: "Becomes the link text, so screen-reader users hear \"Watch Maya's story\"." } },
        role: { type: "text", label: "Role" },
        teaser: { type: "textarea", label: "Teaser", metadata: { help: "One short line from the video. Optional." } },
        posterUrl: { type: "text", label: "Poster image URL", metadata: { help: "A 16:9 still from the video. Leave blank for a plain tile." } },
        posterAlt: { type: "text", label: "Poster alt text", metadata: { help: "Usually blank: the name already labels the link." } },
        videoUrl: { type: "text", label: "Video link", metadata: { help: "The full video page (YouTube, Vimeo, etc.). Opens in a new tab. Ideally the video has captions." } },
        duration: { type: "text", label: "Length", metadata: { help: "Like 2:14. Shown as a badge on the poster." } },
      },
    },
    style: {
      type: "radio",
      label: "Style",
      options: [
        { label: "Dark", value: "dark" },
        { label: "Light", value: "light" },
      ],
    },
  },
  defaultProps: {
    eyebrow: "Watch",
    heading: "Hear it from the people who lived it",
    headingLevel: "h2",
    intro: "Three graduates of our adult literacy program, in their own words. Every video is captioned.",
    style: "dark",
    videos: [
      {
        name: "Maya Thompson",
        role: "Class of 2024",
        teaser: "I read my daughter's report card myself for the first time.",
        posterUrl: "https://picsum.photos/seed/maya-story/960/540",
        posterAlt: "",
        videoUrl: "https://vimeo.com/",
        duration: "2:14",
      },
      {
        name: "Ernesto Ruiz",
        role: "Now a volunteer tutor",
        teaser: "Somebody sat with me every Tuesday. Now I get to be that somebody.",
        posterUrl: "https://picsum.photos/seed/ernesto-story/960/540",
        posterAlt: "",
        videoUrl: "https://vimeo.com/",
        duration: "3:02",
      },
      {
        name: "Gloria Abernathy",
        role: "Class of 2023",
        teaser: "At 67, I passed my driver's test on the first try.",
        posterUrl: "https://picsum.photos/seed/gloria-story/960/540",
        posterAlt: "",
        videoUrl: "https://vimeo.com/",
        duration: "1:48",
      },
    ],
  },
  render: ({ eyebrow, heading, headingLevel, intro, videos, style }) => {
    const H = headingLevel || "h2";
    const Sub = subLevel[headingLevel || "h2"];
    const dark = style !== "light";
    const list = (videos ?? []).filter((v) => v?.name || v?.posterUrl);
    const hasHeader = Boolean(eyebrow || heading || intro);

    return (
      <section className={`${dark ? "bg-neutral-950" : "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 ? (
            <div className="max-w-2xl">
              {eyebrow ? <p className={`text-sm font-semibold tracking-wide uppercase ${dark ? "text-indigo-300" : "text-indigo-700"}`}>{eyebrow}</p> : null}
              {heading ? (
                <H className={`${eyebrow ? "mt-3" : ""} text-3xl font-semibold tracking-tight text-balance sm:text-4xl ${dark ? "text-white" : "text-neutral-950"}`}>{heading}</H>
              ) : null}
              {intro ? <p className={`mt-4 text-lg leading-8 text-pretty ${dark ? "text-neutral-300" : "text-neutral-600"}`}>{intro}</p> : null}
            </div>
          ) : null}

          {list.length > 0 ? (
            <ul role="list" className={`${hasHeader ? "mt-12 sm:mt-16" : ""} grid grid-cols-1 gap-x-6 gap-y-12 lg:gap-x-8 ${gridCols(list.length)}`}>
              {list.map((v, i) => (
                <li key={`${v.name}-${i}`}>
                  <article className="group relative flex flex-col">
                    <div className={`relative aspect-video overflow-hidden rounded-2xl ${dark ? "bg-neutral-800" : "bg-neutral-200"}`}>
                      {v.posterUrl ? (
                        <img
                          src={v.posterUrl}
                          alt={v.posterAlt || ""}
                          className="size-full object-cover transition duration-500 group-hover:scale-105 motion-reduce:transition-none motion-reduce:group-hover:scale-100"
                        />
                      ) : null}
                      <div aria-hidden="true" className="absolute inset-0 bg-linear-to-t from-neutral-950/50 via-transparent to-transparent" />
                      <span
                        aria-hidden="true"
                        className="absolute top-1/2 left-1/2 grid size-16 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full bg-white/95 text-indigo-700 shadow-lg ring-8 ring-white/25 transition group-hover:scale-110 motion-reduce:transition-none motion-reduce:group-hover:scale-100"
                      >
                        <svg viewBox="0 0 20 20" fill="currentColor" className="ml-1 size-6">
                          <path d="M5 3.9v12.2a.9.9 0 0 0 1.4.8l9.5-6.1a.9.9 0 0 0 0-1.6L6.4 3.1A.9.9 0 0 0 5 3.9Z" />
                        </svg>
                      </span>
                      {v.duration ? (
                        <span className="absolute right-3 bottom-3 rounded-md bg-neutral-950/80 px-2 py-0.5 text-xs font-semibold text-white tabular-nums">
                          <span className="sr-only">Length: </span>
                          {v.duration}
                        </span>
                      ) : null}
                    </div>

                    <div className="mt-5">
                      {v.name ? (
                        <Sub className={`text-lg font-semibold ${dark ? "text-white" : "text-neutral-950"}`}>
                          {v.videoUrl ? (
                            <a
                              href={v.videoUrl}
                              target="_blank"
                              rel="noopener noreferrer"
                              className={`after:absolute after:inset-0 after:rounded-2xl focus-visible:outline-none focus-visible:after:outline-2 focus-visible:after:outline-offset-4 ${
                                dark ? "focus-visible:after:outline-indigo-300" : "focus-visible:after:outline-indigo-600"
                              }`}
                            >
                              <span className="sr-only">Watch </span>
                              {v.name}
                              <span className="sr-only">’s story (video, opens in a new tab)</span>
                            </a>
                          ) : (
                            v.name
                          )}
                        </Sub>
                      ) : null}
                      {v.role ? <p className={`mt-1 text-sm ${dark ? "text-indigo-200" : "text-indigo-700"}`}>{v.role}</p> : null}
                      {v.teaser ? (
                        <p className={`mt-3 text-base leading-7 text-pretty ${dark ? "text-neutral-300" : "text-neutral-600"}`}>“{v.teaser}”</p>
                      ) : null}
                    </div>
                  </article>
                </li>
              ))}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
