# Add the "Steps" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/steps) to this Pantheon Content Publisher (P1) Next.js project. A numbered how-it-works process, horizontal or vertical, with an optional call to action.

## Steps

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

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

/**
 * Steps — a numbered process such as "How to volunteer" or "How to apply", in a row across
 * the page on desktop or as a vertical list beside the heading. Optional button underneath.
 * Register: `StepsBlock: stepsBlock` in puck.config.tsx.
 */

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

type Step = {
  title: string;
  description: string;
};

export type StepsProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  steps: Step[];
  layout: "horizontal" | "vertical";
  ctaLabel: string;
  ctaHref: string;
};

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

const rowCols: Record<number, string> = {
  1: "",
  2: "sm:grid-cols-2",
  3: "sm:grid-cols-2 lg:grid-cols-3",
};

export const stepsBlock: ComponentConfig<StepsProps> = {
  label: "Steps",
  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" },
    steps: {
      type: "array",
      label: "Steps",
      min: 1,
      max: 8,
      getItemSummary: (item) => item?.title?.slice(0, 48) || "Step",
      defaultItemProps: { title: "New step", description: "" },
      arrayFields: {
        title: { type: "text", label: "Title" },
        description: { type: "textarea", label: "Description" },
      },
    },
    layout: {
      type: "radio",
      label: "Layout",
      options: [
        { label: "Row", value: "horizontal" },
        { label: "List", value: "vertical" },
      ],
      metadata: { help: "\"Row\" puts steps side by side on desktop and suits three or four short steps. \"List\" suits longer descriptions. Both stack on phones." },
    },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Shown under the steps. Leave blank to hide it." } },
    ctaHref: { type: "text", label: "Button link", metadata: { help: "A path (/volunteer), full URL, #anchor, mailto: or tel:." } },
  },
  defaultProps: {
    heading: "How to start volunteering",
    headingLevel: "h2",
    intro: "Most volunteers are on their first shift within two weeks. Here's what to expect between signing up and showing up.",
    steps: [
      {
        title: "Create your profile",
        description: "Tell us your interests and availability. It takes about five minutes and you can change it anytime.",
      },
      {
        title: "Attend an orientation",
        description: "Join a one-hour session, online or in person, to meet the team and learn how a shift runs.",
      },
      {
        title: "Complete a background check",
        description: "Required for programs with young people. We cover the cost, and results usually arrive in three days.",
      },
      {
        title: "Pick your first shift",
        description: "Choose from food sorting, tutoring, trail work and more. A team lead will meet you when you arrive.",
      },
    ],
    layout: "horizontal",
    ctaLabel: "Sign up to volunteer",
    ctaHref: "/volunteer/apply",
  },
  render: ({ heading, headingLevel, intro, steps, layout, ctaLabel, ctaHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (steps ?? []).filter((s) => s?.title);
    const vertical = layout === "vertical";
    const hasHeader = Boolean(heading || intro);

    const header = hasHeader ? (
      <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;

    const cta = ctaLabel ? (
      <a
        href={ctaHref || "#"}
        className="inline-flex min-h-11 items-center justify-center 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"
      >
        {ctaLabel}
      </a>
    ) : null;

    const number = (i: number) => (
      <span
        aria-hidden="true"
        className="relative z-10 grid size-11 shrink-0 place-items-center rounded-full bg-indigo-600 text-base font-semibold text-white tabular-nums ring-8 ring-white"
      >
        {i + 1}
      </span>
    );

    if (vertical) {
      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 grid max-w-7xl grid-cols-1 gap-12 lg:grid-cols-12 lg:gap-16">
            {header ? <div className="lg:col-span-5">{header}</div> : null}
            <div className={hasHeader ? "lg:col-span-7" : "lg:col-span-8 lg:col-start-3"}>
              {list.length ? (
                <ol>
                  {list.map((step, i) => (
                    <li key={`${step.title}-${i}`} className="group relative flex gap-5 pb-10 last:pb-0 sm:gap-6">
                      <span aria-hidden="true" className="absolute top-14 bottom-3 left-5.5 w-px -translate-x-1/2 bg-neutral-200 group-last:hidden" />
                      {number(i)}
                      <div className="min-w-0 pt-2">
                        <Sub className="text-lg leading-7 font-semibold tracking-tight text-pretty text-neutral-950">{step.title}</Sub>
                        {step.description ? <p className="mt-2 text-base leading-7 text-pretty text-neutral-600">{step.description}</p> : null}
                      </div>
                    </li>
                  ))}
                </ol>
              ) : null}
              {cta ? <div className={`${list.length ? "mt-12" : ""} sm:pl-17`}>{cta}</div> : null}
            </div>
          </div>
        </section>
      );
    }

    const cols = rowCols[list.length] ?? "sm:grid-cols-2 lg:grid-cols-4";
    const connectors = list.length <= 4;
    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">
          {header}
          {list.length ? (
            <ol className={`grid grid-cols-1 gap-x-8 gap-y-10 ${cols} ${hasHeader ? "mt-12 sm:mt-16" : ""}`}>
              {list.map((step, i) => (
                <li key={`${step.title}-${i}`} className="group relative">
                  {connectors ? <span aria-hidden="true" className="absolute top-5.5 left-16 -right-3 hidden h-px bg-neutral-200 group-last:hidden lg:block" /> : null}
                  {number(i)}
                  <Sub className="mt-6 text-lg leading-7 font-semibold tracking-tight text-pretty text-neutral-950">{step.title}</Sub>
                  {step.description ? <p className="mt-2 text-base leading-7 text-pretty text-neutral-600">{step.description}</p> : null}
                </li>
              ))}
            </ol>
          ) : null}
          {cta ? <div className={`flex flex-col sm:flex-row ${list.length || hasHeader ? "mt-12 border-t border-neutral-200 pt-10 sm:mt-16" : ""}`}>{cta}</div> : null}
        </div>
      </section>
    );
  },
};
```
