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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/team-grid) to this Pantheon Content Publisher (P1) Next.js project. Staff, board or volunteers with photos (or initials), roles and short bios.

## Steps

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

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

/**
 * Team Grid — staff, board or volunteer leaders with photo, role and a short bio.
 * Shows initials when a photo is missing; a profile link makes the whole card clickable.
 * Register: `TeamGridBlock: teamGridBlock` in puck.config.tsx.
 */

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

type Member = {
  name: string;
  role: string;
  photoUrl: string;
  photoAlt: string;
  bio: string;
  profileHref: string;
};

export type TeamGridProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  members: Member[];
  columns: "2" | "3" | "4";
  photoShape: "square" | "circle";
};

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

const gridCols = {
  "2": "sm:grid-cols-2",
  "3": "sm:grid-cols-2 lg:grid-cols-3",
  "4": "sm:grid-cols-2 lg:grid-cols-4",
} as const;

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

export const teamGridBlock: ComponentConfig<TeamGridProps> = {
  label: "Team Grid",
  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" },
    members: {
      type: "array",
      label: "People",
      min: 1,
      max: 48,
      getItemSummary: (item) => item?.name || "Person",
      defaultItemProps: { name: "New person", role: "Role", photoUrl: "", photoAlt: "", bio: "", profileHref: "" },
      arrayFields: {
        name: { type: "text", label: "Name" },
        role: { type: "text", label: "Role or title" },
        photoUrl: { type: "text", label: "Photo URL", metadata: { help: "Leave blank to show initials instead." } },
        photoAlt: { type: "text", label: "Photo alt text", metadata: { help: "Usually blank, since the name is printed under the photo." } },
        bio: { type: "textarea", label: "Short bio", metadata: { help: "One or two sentences. Leave blank to hide it." } },
        profileHref: { type: "text", label: "Profile link", metadata: { help: "Optional. When set, the whole card links to this page." } },
      },
    },
    columns: {
      type: "select",
      label: "Columns on desktop",
      options: [
        { label: "2", value: "2" },
        { label: "3", value: "3" },
        { label: "4", value: "4" },
      ],
      metadata: { help: "Phones show one column and tablets two, whatever you pick here." },
    },
    photoShape: {
      type: "radio",
      label: "Photo shape",
      options: [
        { label: "Square", value: "square" },
        { label: "Circle", value: "circle" },
      ],
    },
  },
  defaultProps: {
    heading: "Meet the people behind the work",
    headingLevel: "h2",
    intro: "A small staff and a dedicated volunteer board keep our pantries stocked and our doors open six days a week.",
    members: [
      {
        name: "Marisol Vega",
        role: "Executive Director",
        photoUrl: "https://picsum.photos/seed/marisol/600/600",
        photoAlt: "",
        bio: "Marisol joined in 2016 after a decade organizing tenant associations on the west side.",
        profileHref: "/about/marisol-vega",
      },
      {
        name: "James Whitfield",
        role: "Director of Operations",
        photoUrl: "https://picsum.photos/seed/whitfield/600/600",
        photoAlt: "",
        bio: "James runs our warehouse and fleet, moving two million pounds of food a year.",
        profileHref: "/about/james-whitfield",
      },
      {
        name: "Priya Raman",
        role: "Volunteer Coordinator",
        photoUrl: "https://picsum.photos/seed/priyaraman/600/600",
        photoAlt: "",
        bio: "Priya matches more than 1,200 volunteers each year with shifts that fit their lives.",
        profileHref: "",
      },
      {
        name: "Thomas Bell",
        role: "Board Chair",
        photoUrl: "",
        photoAlt: "",
        bio: "A retired school principal, Thomas has served on the board since our founding.",
        profileHref: "",
      },
    ],
    columns: "4",
    photoShape: "square",
  },
  render: ({ heading, headingLevel, intro, members, columns, photoShape }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (members ?? []).filter((m) => m?.name);
    const circle = photoShape === "circle";
    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">
          {heading || intro ? (
            <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}
          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-x-8 gap-y-12 ${heading || intro ? "mt-12 sm:mt-16" : ""} ${gridCols[columns] || gridCols["3"]}`}>
              {list.map((member, i) => {
                const monogram = initials(member.name);
                return (
                  <li key={`${member.name}-${i}`} className={`group relative ${circle ? "flex flex-col items-center text-center" : ""}`}>
                    {member.photoUrl ? (
                      <img
                        src={member.photoUrl}
                        alt={member.photoAlt || ""}
                        className={`bg-neutral-100 object-cover ring-1 ring-neutral-900/5 ${
                          circle ? "size-36 rounded-full sm:size-40" : "aspect-square w-full rounded-2xl"
                        } ${member.profileHref ? "transition duration-300 motion-safe:group-hover:-translate-y-1" : ""}`}
                      />
                    ) : (
                      <div
                        aria-hidden="true"
                        className={`grid place-items-center bg-indigo-50 font-semibold tracking-tight text-indigo-700 ring-1 ring-indigo-100 ${
                          circle ? "size-36 rounded-full text-4xl sm:size-40" : "aspect-square w-full rounded-2xl text-5xl sm:text-6xl"
                        }`}
                      >
                        {monogram}
                      </div>
                    )}
                    <Sub className="mt-5 text-lg leading-7 font-semibold tracking-tight text-neutral-950">
                      {member.profileHref ? (
                        <a
                          href={member.profileHref}
                          className="after:absolute after:-inset-2 after:rounded-2xl group-hover:text-indigo-700 focus-visible:outline-none focus-visible:after:outline-2 focus-visible:after:outline-indigo-600"
                        >
                          {member.name}
                        </a>
                      ) : (
                        member.name
                      )}
                    </Sub>
                    {member.role ? <p className="text-sm leading-6 font-medium text-indigo-700">{member.role}</p> : null}
                    {member.bio ? <p className="mt-3 text-sm leading-6 text-pretty text-neutral-600">{member.bio}</p> : null}
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
