# Add the "Collection Highlights" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/collection-highlights) to this Pantheon Content Publisher (P1) Next.js project. Salon-hung artworks with true museum wall labels: artist, italic title, medium, dimensions, credit line, accession.

## Steps

1. Create `components/puck/collection-highlights-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 { collectionHighlightsBlock } from "./components/puck/collection-highlights-block";`
3. Register it under `components` as `CollectionHighlightsBlock: collectionHighlightsBlock`.
4. Add `"CollectionHighlightsBlock"` to the best-fitting entry in `categories` (this block's library category is "Arts & culture"). 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/collection-highlights-block.tsx`

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

/**
 * Collection Highlights — selected artworks hung salon-style (uncropped, varied heights) with
 * true museum wall labels: artist, nationality and dates, italic title and year, medium,
 * dimensions, credit line and accession number. Register:
 * `CollectionHighlightsBlock: collectionHighlightsBlock` in puck.config.tsx.
 */

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

type Work = {
  imageUrl: string;
  imageAlt: string;
  artist: string;
  artistDetails: string;
  title: string;
  year: string;
  medium: string;
  dimensions: string;
  creditLine: string;
  accession: string;
  href: string;
};

export type CollectionHighlightsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  layout: "salon" | "rows";
  linkLabel: string;
  allLabel: string;
  allHref: string;
  works: Work[];
};

const SUB = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;
const ring = "focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-indigo-600";

function Arrow() {
  return (
    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 transition group-hover:translate-x-0.5 motion-reduce:transition-none">
      <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>
  );
}

export const collectionHighlightsBlock: ComponentConfig<CollectionHighlightsProps> = {
  label: "Collection Highlights",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Leave blank to hide it." } },
    heading: { type: "text", label: "Heading", metadata: { help: "Wrap one word in *asterisks* to set it in italic accent." } },
    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: "Leave blank to hide it." } },
    layout: {
      type: "radio",
      label: "Hang",
      options: [
        { label: "Salon (uncropped)", value: "salon" },
        { label: "Even rows", value: "rows" },
      ],
      metadata: { help: "Salon shows every work at its true proportions in staggered columns. Even rows crops to a matching shape." },
    },
    linkLabel: { type: "text", label: "Artwork link text", metadata: { help: "Shown on works that have a link, like View in collection." } },
    allLabel: { type: "text", label: "Collection link text", metadata: { help: "Leave blank to hide it." } },
    allHref: { type: "text", label: "Collection link" },
    works: {
      type: "array",
      label: "Artworks",
      min: 1,
      max: 12,
      getItemSummary: (item) => [item?.title, item?.artist].filter(Boolean).join(", ") || "Artwork",
      defaultItemProps: {
        imageUrl: "https://picsum.photos/seed/artwork/900/1100",
        imageAlt: "",
        artist: "Artist name",
        artistDetails: "",
        title: "Untitled",
        year: "",
        medium: "",
        dimensions: "",
        creditLine: "",
        accession: "",
        href: "",
      },
      arrayFields: {
        imageUrl: { type: "text", label: "Image URL" },
        imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe what the work shows, not just its title." } },
        artist: { type: "text", label: "Artist" },
        artistDetails: { type: "text", label: "Artist details", metadata: { help: "Nationality and dates, like American, born 1961. Leave blank to hide it." } },
        title: { type: "text", label: "Title", metadata: { help: "Shown in italics, as labels do." } },
        year: { type: "text", label: "Date", metadata: { help: "Like 1974, or c. 1890." } },
        medium: { type: "text", label: "Medium", metadata: { help: "Like Oil on linen." } },
        dimensions: { type: "text", label: "Dimensions", metadata: { help: "Like 48 × 36 in. (121.9 × 91.4 cm)." } },
        creditLine: { type: "text", label: "Credit line", metadata: { help: "Like Gift of the Arneson Family, 2003." } },
        accession: { type: "text", label: "Accession number", metadata: { help: "Like 2003.14.2. Leave blank to hide it." } },
        href: { type: "text", label: "Collection link", metadata: { help: "The work's online collection record. Leave blank for no link." } },
      },
    },
  },
  defaultProps: {
    eyebrow: "From the collection",
    heading: "Works we keep *returning* to",
    headingLevel: "h2",
    intro: "Six objects from the Halvorsen's 14,000-work permanent collection, chosen by our curators. All are on view in the second-floor galleries unless noted.",
    layout: "salon",
    linkLabel: "View in collection",
    allLabel: "Search the collection",
    allHref: "/collection",
    works: [
      {
        imageUrl: "https://picsum.photos/seed/riverbend/900/1150",
        imageAlt: "Tall painting of a river bending through birch woods in muted greens and ochres",
        artist: "Agnes Thorvaldsen",
        artistDetails: "American, 1871–1949",
        title: "The River at Halvorsen Bend",
        year: "1912",
        medium: "Oil on canvas",
        dimensions: "54 × 42 in. (137.2 × 106.7 cm)",
        creditLine: "Gift of the Arneson Family, 1958",
        accession: "1958.3",
        href: "/collection/1958-3",
      },
      {
        imageUrl: "https://picsum.photos/seed/bluevessel/900/900",
        imageAlt: "A wide stoneware bowl glazed in pooled cobalt blue, photographed from slightly above",
        artist: "Kenji Arakawa-Moss",
        artistDetails: "Japanese American, born 1958",
        title: "Vessel for Still Water",
        year: "2004",
        medium: "Wood-fired stoneware, cobalt glaze",
        dimensions: "7 × 19 in. (17.8 × 48.3 cm)",
        creditLine: "Museum purchase with funds from the Contemporary Craft Council",
        accession: "2005.41",
        href: "/collection/2005-41",
      },
      {
        imageUrl: "https://picsum.photos/seed/portraitwoman/900/1200",
        imageAlt: "Portrait of a woman in a red headscarf looking directly at the viewer against a gold ground",
        artist: "Dolores Achterberg",
        artistDetails: "Dutch, 1903–1988",
        title: "Portrait of Elsbeth",
        year: "c. 1935",
        medium: "Tempera and gold leaf on panel",
        dimensions: "24 × 18 in. (61 × 45.7 cm)",
        creditLine: "Bequest of Harold and Ruth Lindgren",
        accession: "1991.12.4",
        href: "/collection/1991-12-4",
      },
      {
        imageUrl: "https://picsum.photos/seed/gridweave/1200/900",
        imageAlt: "Woven wall hanging of overlapping indigo and undyed wool squares",
        artist: "Ruth Ngata-Ellison",
        artistDetails: "New Zealander, born 1966",
        title: "Map of the Lake District, Folded",
        year: "2019",
        medium: "Hand-dyed wool, linen warp",
        dimensions: "60 × 80 in. (152.4 × 203.2 cm)",
        creditLine: "Gift of the Friends of Textiles, 2020",
        accession: "2020.7",
        href: "/collection/2020-7",
      },
      {
        imageUrl: "https://picsum.photos/seed/bronzefigure/900/1300",
        imageAlt: "Slender bronze figure with raised arms on a square limestone base",
        artist: "Teodor Vasquez-Lund",
        artistDetails: "Mexican, 1920–2001",
        title: "Morning Figure",
        year: "1967",
        medium: "Bronze, limestone base",
        dimensions: "41 × 9 × 9 in. (104.1 × 22.9 × 22.9 cm)",
        creditLine: "Gift of Margit and Paul Osterlund, 1974",
        accession: "1974.22",
        href: "/collection/1974-22",
      },
      {
        imageUrl: "https://picsum.photos/seed/prairiephoto/1200/850",
        imageAlt: "Black-and-white photograph of a grain elevator under a heavy storm sky",
        artist: "Willa Brekke",
        artistDetails: "American, born 1944",
        title: "Elevator, Pipestone County",
        year: "1979, printed 2011",
        medium: "Gelatin silver print",
        dimensions: "16 × 20 in. (40.6 × 50.8 cm)",
        creditLine: "Gift of the artist",
        accession: "2011.88",
        href: "",
      },
    ],
  },
  render: ({ eyebrow, heading, headingLevel, intro, layout, linkLabel, allLabel, allHref, works }) => {
    const H = headingLevel || "h2";
    const Sub = SUB[H] ?? "h3";
    const list = (works ?? []).filter((w) => w?.imageUrl || w?.title);
    const salon = layout !== "rows";

    const headingParts = (heading || "").split(/(\*[^*]+\*)/g).map((part, i) =>
      part.length > 2 && part.startsWith("*") && part.endsWith("*") ? (
        <em key={i} className="text-indigo-700 italic">
          {part.slice(1, -1)}
        </em>
      ) : (
        part
      ),
    );

    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">
          {eyebrow || heading || intro ? (
            <header className="grid grid-cols-1 gap-6 border-b border-neutral-950 pb-10 lg:grid-cols-12 lg:items-end lg:gap-12">
              <div className="lg:col-span-8">
                {eyebrow ? <p className="text-xs font-semibold tracking-widest text-neutral-950 uppercase">{eyebrow}</p> : null}
                {heading ? <H className={`${eyebrow ? "mt-4" : ""} font-serif text-5xl leading-none font-normal tracking-tight text-balance text-neutral-950 sm:text-6xl lg:text-7xl`}>{headingParts}</H> : null}
              </div>
              {intro || allLabel ? (
                <div className="lg:col-span-4">
                  {intro ? <p className="text-base leading-7 text-pretty text-neutral-600">{intro}</p> : null}
                  {allLabel ? (
                    <a href={allHref || "#"} className={`group mt-4 inline-flex min-h-11 items-center gap-2 text-sm font-semibold text-neutral-950 underline decoration-indigo-600 underline-offset-4 hover:decoration-2 ${ring}`}>
                      {allLabel}
                      <Arrow />
                    </a>
                  ) : null}
                </div>
              ) : null}
            </header>
          ) : null}

          {list.length ? (
            <ul role="list" className={`mt-12 lg:mt-16 ${salon ? "columns-1 gap-10 sm:columns-2 lg:columns-3 lg:gap-14" : "grid grid-cols-1 gap-x-10 gap-y-14 sm:grid-cols-2 lg:grid-cols-3 lg:gap-x-14"}`}>
              {list.map((w, i) => (
                <li key={`${w.title}-${i}`} className={salon ? "mb-14 break-inside-avoid" : ""}>
                  <article>
                    {w.imageUrl ? (
                      <div className="bg-white p-3 shadow-sm ring-1 ring-neutral-950/5 sm:p-5">
                        <img src={w.imageUrl} alt={w.imageAlt || ""} loading="lazy" className={`w-full bg-neutral-100 ${salon ? "h-auto" : "aspect-4/5 object-cover"}`} />
                      </div>
                    ) : null}
                    <div className={`${w.imageUrl ? "mt-5" : ""} max-w-sm border-l border-neutral-950 pl-4 text-sm leading-5`}>
                      {w.artist ? <p className="font-semibold text-neutral-950">{w.artist}</p> : null}
                      {w.artistDetails ? <p className="text-neutral-600">{w.artistDetails}</p> : null}
                      {w.title ? (
                        <Sub className="mt-3 font-serif text-xl leading-snug font-normal text-neutral-950">
                          <cite className="italic">{w.title}</cite>
                          {w.year ? <span className="not-italic">, {w.year}</span> : null}
                        </Sub>
                      ) : null}
                      {w.medium || w.dimensions ? (
                        <p className="mt-2 text-neutral-600">
                          {w.medium}
                          {w.medium && w.dimensions ? <br /> : null}
                          <span className="tabular-nums">{w.dimensions}</span>
                        </p>
                      ) : null}
                      {w.creditLine || w.accession ? (
                        <p className="mt-3 text-xs leading-5 text-neutral-600">
                          {w.creditLine}
                          {w.accession ? <span className="block tabular-nums">{w.accession}</span> : null}
                        </p>
                      ) : null}
                      {w.href && linkLabel ? (
                        <a href={w.href} className={`group mt-2 inline-flex min-h-11 items-center gap-1.5 text-sm font-semibold text-indigo-700 hover:text-indigo-900 ${ring}`}>
                          {linkLabel}
                          {w.title ? <span className="sr-only">: {w.title}</span> : null}
                          <Arrow />
                        </a>
                      ) : null}
                    </div>
                  </article>
                </li>
              ))}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
