# Add the "CTA Deadline" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/cta-deadline) to this Pantheon Content Publisher (P1) Next.js project. Registration-deadline band led by a tear-off calendar date stamp, with quick facts like fee and spots left and a register button.

## Steps

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

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

/**
 * CTA Deadline — a registration-deadline band led by a tear-off calendar date stamp, with the
 * closing line, a few quick facts (seats left, fee) and a register button plus a details link.
 * Register: `CtaDeadlineBlock: ctaDeadlineBlock` in puck.config.tsx.
 */

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

type Fact = { label: string; value: string };

export type CtaDeadlineProps = {
  month: string;
  day: string;
  weekday: string;
  deadlineLine: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  facts: Fact[];
  primaryLabel: string;
  primaryHref: string;
  secondaryLabel: string;
  secondaryHref: string;
};

export const ctaDeadlineBlock: ComponentConfig<CtaDeadlineProps> = {
  label: "CTA Deadline",
  fields: {
    month: { type: "text", label: "Month", metadata: { help: "Short month on the date stamp, such as Mar. Leave month and day blank to hide the stamp." } },
    day: { type: "text", label: "Day", metadata: { help: "Day of the month, such as 14. Can be bound to a data source." } },
    weekday: { type: "text", label: "Weekday", metadata: { help: "Such as Friday. Leave blank to hide it." } },
    deadlineLine: { type: "text", label: "Deadline line", metadata: { help: "The full deadline in words, such as \"Registration closes Friday, March 14 at 11:59 p.m.\" Screen readers rely on this, so include the date." } },
    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." },
    },
    body: { type: "textarea", label: "Body" },
    facts: {
      type: "array",
      label: "Quick facts",
      min: 0,
      max: 3,
      getItemSummary: (item) => [item?.label, item?.value].filter(Boolean).join(": ") || "Fact",
      defaultItemProps: { label: "Fee", value: "$40" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        value: { type: "text", label: "Value", metadata: { help: "Text, so it can be bound to a data source such as seats remaining." } },
      },
      metadata: { help: "Short facts such as fee, seats left or ages." },
    },
    primaryLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
    primaryHref: { type: "text", label: "Button link" },
    secondaryLabel: { type: "text", label: "Secondary link text", metadata: { help: "Leave blank to hide the link." } },
    secondaryHref: { type: "text", label: "Secondary link" },
  },
  defaultProps: {
    month: "Mar",
    day: "14",
    weekday: "Friday",
    deadlineLine: "Registration closes Friday, March 14 at 11:59 p.m.",
    heading: "Spring youth soccer fills up fast",
    headingLevel: "h2",
    body: "Co-ed teams for ages 5–14 play Saturday mornings at Riverside and Elm Park, April through May. Fee assistance is available for every family who asks.",
    facts: [
      { label: "Fee", value: "$65 resident" },
      { label: "Spots left", value: "38 of 240" },
      { label: "Ages", value: "5–14" },
    ],
    primaryLabel: "Register a player",
    primaryHref: "/register/youth-soccer",
    secondaryLabel: "Fees, teams and field map",
    secondaryHref: "/programs/youth-soccer",
  },
  render: ({ month, day, weekday, deadlineLine, heading, headingLevel, body, facts, primaryLabel, primaryHref, secondaryLabel, secondaryHref }) => {
    const H = headingLevel || "h2";
    const list = (facts ?? []).filter((f) => f?.label || f?.value);
    const hasStamp = Boolean(month || day);
    const hasCopy = Boolean(deadlineLine || heading || body || list.length);
    const hasActions = Boolean(primaryLabel || secondaryLabel);
    if (!hasStamp && !hasCopy && !hasActions) return <></>;

    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 rounded-3xl bg-indigo-50 p-6 ring-1 ring-indigo-100 sm:p-10 lg:p-12">
          <div className="flex flex-col gap-8 sm:flex-row sm:flex-wrap sm:items-start lg:flex-nowrap lg:items-center lg:gap-12">
            {hasStamp ? (
              <div aria-hidden={deadlineLine ? "true" : undefined} className="w-28 shrink-0 -rotate-2 overflow-hidden rounded-2xl bg-white text-center shadow-md ring-1 ring-neutral-950/10 sm:w-32">
                <p className="bg-indigo-600 py-1.5 text-sm font-bold tracking-widest text-white uppercase">{month || " "}</p>
                <p className="pt-2 text-5xl leading-none font-semibold tracking-tight text-neutral-950 tabular-nums sm:text-6xl">{day || " "}</p>
                <p className="pt-1 pb-3 text-xs font-semibold tracking-wide text-neutral-600 uppercase">{weekday || " "}</p>
              </div>
            ) : null}

            {hasCopy ? (
              <div className="min-w-0 flex-1">
                {deadlineLine ? (
                  <p className="flex items-center gap-2 text-sm font-semibold text-indigo-800">
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                      <path fillRule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z" clipRule="evenodd" />
                    </svg>
                    {deadlineLine}
                  </p>
                ) : null}
                {heading ? (
                  <H className={`text-2xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-3xl lg:text-4xl ${deadlineLine ? "mt-3" : ""}`}>{heading}</H>
                ) : null}
                {body ? <p className="mt-3 max-w-2xl text-base leading-7 text-pretty text-neutral-700">{body}</p> : null}
                {list.length ? (
                  <dl className="mt-6 flex flex-wrap gap-x-8 gap-y-3 border-t border-indigo-200 pt-5">
                    {list.map((f, i) => (
                      <div key={`${f.label}-${i}`} className="min-w-0">
                        {f.label ? <dt className="text-xs font-semibold tracking-wide text-neutral-600 uppercase">{f.label}</dt> : null}
                        {f.value ? <dd className="mt-0.5 text-base font-semibold text-neutral-950 tabular-nums">{f.value}</dd> : null}
                      </div>
                    ))}
                  </dl>
                ) : null}
              </div>
            ) : null}

            {hasActions ? (
              <div className="flex shrink-0 flex-col gap-3 sm:basis-full sm:flex-row sm:items-center lg:w-64 lg:basis-auto lg:flex-col lg:items-stretch">
                {primaryLabel ? (
                  <a
                    href={primaryHref || "#"}
                    className="inline-flex min-h-12 items-center justify-center rounded-lg bg-indigo-600 px-6 py-3 text-center text-base font-semibold text-white shadow-sm transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                  >
                    {primaryLabel}
                  </a>
                ) : null}
                {secondaryLabel ? (
                  <a
                    href={secondaryHref || "#"}
                    className="inline-flex min-h-11 items-center justify-center rounded-lg px-3 text-center text-sm font-semibold text-indigo-800 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                  >
                    {secondaryLabel}
                  </a>
                ) : null}
              </div>
            ) : null}
          </div>
        </div>
      </section>
    );
  },
};
```
