# Add the "Icon List" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/icon-list) to this Pantheon Content Publisher (P1) Next.js project. A two- or three-column checklist of benefits or inclusions marked with one chosen icon.

## Steps

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

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

/**
 * Icon List — a two- or three-column checklist of benefits or inclusions, each with a short
 * bold lead-in and optional detail, marked with one icon chosen for the whole list.
 * Register: `IconListBlock: iconListBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type IconName = "check" | "check-circle" | "arrow" | "star" | "sparkle" | "heart" | "plus" | "dot";

export type IconListProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  icon: IconName;
  columns: "2" | "3";
  items: { title: string; detail: string }[];
  footnote: string;
  ctaLabel: string;
  ctaHref: string;
};

// 20px solid glyphs so every icon sits on the same optical baseline.
const iconPaths: Record<IconName, string> = {
  check: "M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",
  "check-circle": "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",
  arrow: "M3 10a.75.75 0 0 1 .75-.75h10.638L10.23 5.29a.75.75 0 1 1 1.04-1.08l5.5 5.25a.75.75 0 0 1 0 1.08l-5.5 5.25a.75.75 0 1 1-1.04-1.08l4.158-3.96H3.75A.75.75 0 0 1 3 10Z",
  star: "M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401Z",
  sparkle: "M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684ZM13.949 13.684a1 1 0 0 0-1.898 0l-.184.551a1 1 0 0 1-.632.633l-.551.183a1 1 0 0 0 0 1.898l.551.183a1 1 0 0 1 .633.633l.183.551a1 1 0 0 0 1.898 0l.184-.551a1 1 0 0 1 .632-.633l.551-.183a1 1 0 0 0 0-1.898l-.551-.184a1 1 0 0 1-.633-.632l-.183-.551Z",
  heart: "m9.653 16.915-.005-.003-.019-.01a20.759 20.759 0 0 1-1.162-.682 22.045 22.045 0 0 1-2.582-1.9C4.045 12.733 2 10.352 2 7.5a4.5 4.5 0 0 1 8-2.828A4.5 4.5 0 0 1 18 7.5c0 2.852-2.044 5.233-3.885 6.82a22.049 22.049 0 0 1-3.744 2.582l-.019.01-.005.003h-.002a.739.739 0 0 1-.69.001l-.002-.001Z",
  plus: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z",
  dot: "M10 13.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Z",
};

const iconOptions: { label: string; value: IconName }[] = [
  { label: "Check", value: "check" },
  { label: "Check in circle", value: "check-circle" },
  { label: "Arrow", value: "arrow" },
  { label: "Star", value: "star" },
  { label: "Sparkle", value: "sparkle" },
  { label: "Heart", value: "heart" },
  { label: "Plus", value: "plus" },
  { label: "Dot", value: "dot" },
];

const gridCols: Record<IconListProps["columns"], string> = {
  "2": "sm:grid-cols-2",
  "3": "sm:grid-cols-2 lg:grid-cols-3",
};

export const iconListBlock: ComponentConfig<IconListProps> = {
  label: "Icon List",
  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" },
    icon: { type: "select", label: "Icon", options: iconOptions, metadata: { help: "One marker for every item, so the list scans evenly." } },
    columns: {
      type: "radio",
      label: "Columns",
      options: [
        { label: "Two", value: "2" },
        { label: "Three", value: "3" },
      ],
      metadata: { help: "Columns on wide screens. Phones always show one column." },
    },
    items: {
      type: "array",
      label: "Items",
      min: 1,
      max: 24,
      getItemSummary: (item) => item?.title?.slice(0, 48) || "Item",
      defaultItemProps: { title: "Another benefit", detail: "" },
      arrayFields: {
        title: { type: "text", label: "Title", metadata: { help: "A few words, shown in bold." } },
        detail: { type: "textarea", label: "Detail", metadata: { help: "One short sentence. Leave blank for a simple checklist." } },
      },
    },
    footnote: { type: "text", label: "Footnote", metadata: { help: "Small print under the list. Leave blank to hide it." } },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
    ctaHref: { type: "text", label: "Button link" },
  },
  defaultProps: {
    eyebrow: "Membership",
    heading: "Every household membership includes",
    headingLevel: "h2",
    intro: "One annual pass covers everyone at your address, and every membership helps fund free school field trips to the gardens.",
    icon: "check-circle",
    columns: "3",
    items: [
      { title: "Unlimited admission", detail: "Visit the gardens and conservatory any day we're open, all year." },
      { title: "Two guest passes", detail: "Bring friends or family along on any visit, no blackout dates." },
      { title: "Members' preview nights", detail: "See each new exhibition the evening before it opens to the public." },
      { title: "10% off classes", detail: "Save on workshops from pruning basics to botanical illustration." },
      { title: "Free parking", detail: "Members park free in the Garden Street lot every visit." },
      { title: "Reciprocal admission", detail: "Free or discounted entry at partner gardens nationwide through our reciprocal admissions network." },
    ],
    footnote: "Household memberships cover two adults and all children under 18 living at the same address.",
    ctaLabel: "Become a member",
    ctaHref: "/membership",
  },
  render: ({ eyebrow, heading, headingLevel, intro, icon, columns, items, footnote, ctaLabel, ctaHref }) => {
    const H = headingLevel || "h2";
    const list = (items ?? []).filter((item) => item?.title || item?.detail);
    const path = iconPaths[icon] ?? iconPaths.check;
    const cols = gridCols[columns] ?? gridCols["3"];
    const hasHeader = Boolean(eyebrow || heading || intro);
    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">
          {hasHeader ? (
            <div className="grid grid-cols-1 gap-4 lg:grid-cols-12 lg:gap-16">
              <div className="lg:col-span-6">
                {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{eyebrow}</p> : null}
                {heading ? (
                  <H className={`${eyebrow ? "mt-3" : ""} text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl`}>{heading}</H>
                ) : null}
              </div>
              {intro ? <p className="text-lg leading-8 text-pretty text-neutral-600 lg:col-span-5 lg:col-start-8 lg:self-end">{intro}</p> : null}
            </div>
          ) : null}

          {list.length > 0 ? (
            <div className={`${hasHeader ? "mt-12 sm:mt-14" : ""} rounded-3xl bg-white p-6 shadow-sm ring-1 ring-neutral-950/5 sm:p-10`}>
              <ul role="list" className={`grid grid-cols-1 gap-x-10 gap-y-6 sm:gap-y-8 ${cols}`}>
                {list.map((item, i) => (
                  <li key={`${item.title}-${i}`} className="flex gap-4">
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-6 shrink-0 text-indigo-600">
                      <path fillRule="evenodd" d={path} clipRule="evenodd" />
                    </svg>
                    <p className="text-base leading-7 text-pretty">
                      {item.title ? <span className="font-semibold text-neutral-950">{item.title}</span> : null}
                      {item.title && item.detail ? <br /> : null}
                      {item.detail ? <span className="text-neutral-600">{item.detail}</span> : null}
                    </p>
                  </li>
                ))}
              </ul>

              {footnote || ctaLabel ? (
                <div className="mt-10 flex flex-col gap-6 border-t border-neutral-200 pt-8 sm:flex-row sm:items-center sm:justify-between">
                  {footnote ? <p className="max-w-xl text-sm leading-6 text-pretty text-neutral-600">{footnote}</p> : <span />}
                  {ctaLabel ? (
                    <a
                      href={ctaHref || "#"}
                      className="inline-flex min-h-11 shrink-0 items-center justify-center gap-1.5 self-start rounded-lg bg-indigo-600 px-5 py-3 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:self-auto"
                    >
                      {ctaLabel}
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
