# Add the "Research Centers" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/research-centers) to this Pantheon Content Publisher (P1) Next.js project. Cards for research centers and labs with a photo, director, focus-area tags and a link.

## Steps

1. Create `components/puck/research-centers-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 { researchCentersBlock } from "./components/puck/research-centers-block";`
3. Register it under `components` as `ResearchCentersBlock: researchCentersBlock`.
4. Add `"ResearchCentersBlock"` to the best-fitting entry in `categories` (this block's library category is "Higher ed"). 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/research-centers-block.tsx`

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

/**
 * Research Centers — cards for institutes and labs, each with a photo, director, focus-area
 * tags and a link. Image beside the copy from small screens up, two cards across on desktop.
 * Register: `ResearchCentersBlock: researchCentersBlock` in puck.config.tsx.
 */

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

type Center = {
  name: string;
  kind: string;
  director: string;
  summary: string;
  focusAreas: string;
  imageUrl: string;
  imageAlt: string;
  href: string;
};

export type ResearchCentersProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  centers: Center[];
  allLabel: string;
  allHref: string;
};

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

export const researchCentersBlock: ComponentConfig<ResearchCentersProps> = {
  label: "Research Centers",
  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" },
    centers: {
      type: "array",
      label: "Centers and labs",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.name || "Center",
      defaultItemProps: {
        name: "New research center",
        kind: "Lab",
        director: "",
        summary: "",
        focusAreas: "First focus, Second focus",
        imageUrl: "https://picsum.photos/seed/lab/800/600",
        imageAlt: "",
        href: "/research",
      },
      arrayFields: {
        name: { type: "text", label: "Name" },
        kind: { type: "text", label: "Type", metadata: { help: "Such as Institute, Center or Lab. Leave blank to hide it." } },
        director: { type: "text", label: "Director", metadata: { help: "Name and title, such as Dr. Ana Ruiz, Professor of Biology." } },
        summary: { type: "textarea", label: "Summary", metadata: { help: "One or two sentences. Leave blank to hide it." } },
        focusAreas: { type: "text", label: "Focus areas", metadata: { help: "Separate with commas. Each becomes a tag." } },
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "Landscape photo, about 4:3. Leave blank for no image." } },
        imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for people who can't see it. Leave blank only if it's purely decorative." } },
        href: { type: "text", label: "Link", metadata: { help: "The center's page. The whole card links here." } },
      },
    },
    allLabel: { type: "text", label: "All centers link text", metadata: { help: "Leave blank to hide it." } },
    allHref: { type: "text", label: "All centers link" },
  },
  defaultProps: {
    eyebrow: "Research",
    heading: "Centers and labs",
    headingLevel: "h2",
    intro: "Northfield's research centers bring faculty, graduate students and undergraduates together around problems that matter to the region, and most welcome first-year students into their labs.",
    centers: [
      {
        name: "Great Rivers Water Institute",
        kind: "Institute",
        director: "Dr. Maya Okafor, Professor of Civil Engineering",
        summary: "Monitors water quality across three river basins and works with towns to plan for flooding and drought.",
        focusAreas: "Hydrology, Flood resilience, Water policy",
        imageUrl: "https://picsum.photos/seed/river/800/600",
        imageAlt: "Researchers in waders taking water samples from a shallow river",
        href: "/research/water-institute",
      },
      {
        name: "Center for Rural Health Equity",
        kind: "Center",
        director: "Dr. Daniel Reyes, Associate Professor of Public Health",
        summary: "Partners with county clinics to study access to care, telehealth and maternal health outcomes in rural communities.",
        focusAreas: "Public health, Telehealth, Community partnerships",
        imageUrl: "https://picsum.photos/seed/clinic/800/600",
        imageAlt: "A nurse and a community health worker reviewing a tablet together",
        href: "/research/rural-health",
      },
      {
        name: "Applied Machine Learning Lab",
        kind: "Lab",
        director: "Dr. Priya Natarajan, Assistant Professor of Computer Science",
        summary: "Builds open, auditable machine learning tools for agriculture, public records and accessibility.",
        focusAreas: "Machine learning, Accessibility, Open data",
        imageUrl: "https://picsum.photos/seed/circuit/800/600",
        imageAlt: "Students gathered around a laptop and a small sensor board in a lab",
        href: "/research/ml-lab",
      },
      {
        name: "Prairie Archaeology Field Lab",
        kind: "Lab",
        director: "Dr. Thomas Whitehorse, Professor of Anthropology",
        summary: "Runs a summer field school and works with tribal nations to document and protect cultural sites.",
        focusAreas: "Archaeology, Field school, Cultural heritage",
        imageUrl: "https://picsum.photos/seed/prairie/800/600",
        imageAlt: "A field crew working at a marked excavation site in open grassland",
        href: "/research/archaeology-lab",
      },
    ],
    allLabel: "See all 28 centers and labs",
    allHref: "/research/centers",
  },
  render: ({ eyebrow, heading, headingLevel, intro, centers, allLabel, allHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (centers ?? []).filter((c) => c?.name);
    const hasHeader = Boolean(eyebrow || heading || intro || allLabel);

    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 ? (
            <div className="flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between lg:gap-16">
              <div className="max-w-2xl">
                {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{eyebrow}</p> : null}
                {heading ? (
                  <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl lg:text-5xl ${eyebrow ? "mt-3" : ""}`}>{heading}</H>
                ) : null}
                {intro ? <p className="mt-5 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
              </div>
              {allLabel ? (
                <a
                  href={allHref || "#"}
                  className="group inline-flex min-h-11 shrink-0 items-center gap-2 self-start rounded-lg px-1 text-base font-semibold text-indigo-700 hover:text-indigo-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 lg:self-auto"
                >
                  {allLabel}
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 transition motion-safe:group-hover:translate-x-0.5">
                    <path fillRule="evenodd" d="M3 10a.75.75 0 0 1 .75-.75h10.64l-3.22-3.22a.75.75 0 1 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H3.75A.75.75 0 0 1 3 10Z" clipRule="evenodd" />
                  </svg>
                </a>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-6 lg:grid-cols-2 lg:gap-8 ${hasHeader ? "mt-10 sm:mt-14" : ""}`}>
              {list.map((center, i) => {
                const tags = (center.focusAreas || "")
                  .split(",")
                  .map((t) => t.trim())
                  .filter(Boolean);
                return (
                  <li key={`${center.name}-${i}`}>
                    <article className="group relative flex h-full flex-col overflow-hidden rounded-2xl bg-white ring-1 ring-neutral-200 transition hover:shadow-lg hover:shadow-neutral-900/5 hover:ring-indigo-300 sm:flex-row">
                      {center.imageUrl ? (
                        <div className="relative aspect-4/3 shrink-0 overflow-hidden bg-neutral-100 sm:aspect-auto sm:w-2/5">
                          <img
                            src={center.imageUrl}
                            alt={center.imageAlt || ""}
                            loading="lazy"
                            className="size-full object-cover transition duration-500 motion-safe:group-hover:scale-105 sm:absolute sm:inset-0"
                          />
                          {center.kind ? (
                            <p className="absolute top-3 left-3 rounded-md bg-white/95 px-2 py-1 text-xs font-semibold tracking-wide text-neutral-900 uppercase shadow-sm">
                              {center.kind}
                            </p>
                          ) : null}
                        </div>
                      ) : null}
                      <div className="flex min-w-0 flex-1 flex-col p-6 sm:p-7">
                        {!center.imageUrl && center.kind ? (
                          <p className="mb-3 text-xs font-semibold tracking-wide text-indigo-700 uppercase">{center.kind}</p>
                        ) : null}
                        <Sub className="text-xl leading-7 font-semibold tracking-tight text-balance text-neutral-950">
                          <a
                            href={center.href || "#"}
                            className="after:absolute after:inset-0 after:rounded-2xl focus-visible:outline-none focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-indigo-600"
                          >
                            {center.name}
                          </a>
                        </Sub>
                        {center.director ? (
                          <p className="mt-2 flex gap-2 text-sm leading-6 text-neutral-700">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-4 shrink-0 text-neutral-500">
                              <path d="M10 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM3.465 14.493a1.23 1.23 0 0 0 .41 1.412A9.957 9.957 0 0 0 10 18c2.31 0 4.438-.784 6.131-2.1.43-.333.604-.903.408-1.41a7.002 7.002 0 0 0-13.074.003Z" />
                            </svg>
                            <span className="min-w-0">
                              <span className="sr-only">Director: </span>
                              {center.director}
                            </span>
                          </p>
                        ) : null}
                        {center.summary ? <p className="mt-3 text-base leading-7 text-pretty text-neutral-600">{center.summary}</p> : null}
                        {tags.length ? (
                          <div className="mt-auto pt-5">
                            <p className="sr-only">Focus areas</p>
                            <ul role="list" className="flex flex-wrap gap-2">
                              {tags.map((tag) => (
                                <li key={tag} className="rounded-full bg-indigo-50 px-2.5 py-1 text-xs font-medium text-indigo-800 ring-1 ring-indigo-600/15 ring-inset">
                                  {tag}
                                </li>
                              ))}
                            </ul>
                          </div>
                        ) : null}
                      </div>
                    </article>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
