# Add the "Callout Box" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/callout-box) to this Pantheon Content Publisher (P1) Next.js project. An inline note, tip or important notice with a visible label, icon and optional link.

## Steps

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

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

/**
 * Callout Box — an inline notice that sits between paragraphs to flag something a reader
 * mustn't miss. Three weights (Note, Tip, Important), each with a visible text label and icon.
 * Register: `CalloutBoxBlock: calloutBoxBlock` in puck.config.tsx.
 */

type Variant = "note" | "tip" | "important";

export type CalloutBoxProps = {
  variant: Variant;
  label: string;
  title: string;
  body: string;
  linkLabel: string;
  linkHref: string;
  width: "prose" | "wide";
};

const variants: Record<
  Variant,
  { defaultLabel: string; box: string; rule: string; label: string; icon: string; title: string; body: string; link: string; iconPath: string }
> = {
  note: {
    defaultLabel: "Note",
    box: "bg-neutral-50 ring-1 ring-neutral-950/5",
    rule: "bg-neutral-400",
    label: "text-neutral-700",
    icon: "text-neutral-500",
    title: "text-neutral-950",
    body: "text-neutral-700",
    link: "text-neutral-950 decoration-neutral-400 hover:decoration-neutral-950 focus-visible:outline-indigo-600",
    iconPath:
      "M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",
  },
  tip: {
    defaultLabel: "Tip",
    box: "bg-indigo-50 ring-1 ring-indigo-600/15",
    rule: "bg-indigo-600",
    label: "text-indigo-800",
    icon: "text-indigo-600",
    title: "text-neutral-950",
    body: "text-neutral-800",
    link: "text-indigo-800 decoration-indigo-300 hover:decoration-indigo-800 focus-visible:outline-indigo-600",
    iconPath:
      "M10 1a6 6 0 0 0-3.815 10.631C7.237 12.5 8 13.443 8 14.456v.644a.75.75 0 0 0 .572.729 6.016 6.016 0 0 0 2.856 0A.75.75 0 0 0 12 15.1v-.644c0-1.013.762-1.957 1.815-2.825A6 6 0 0 0 10 1ZM8.863 17.414a.75.75 0 0 0-.226 1.483 9.066 9.066 0 0 0 2.726 0 .75.75 0 0 0-.226-1.483 7.553 7.553 0 0 1-2.274 0Z",
  },
  important: {
    defaultLabel: "Important",
    box: "bg-indigo-950 shadow-lg shadow-indigo-950/10",
    rule: "bg-indigo-400",
    label: "text-indigo-200",
    icon: "text-indigo-300",
    title: "text-white",
    body: "text-indigo-100",
    link: "text-white decoration-indigo-400 hover:decoration-white focus-visible:outline-white",
    iconPath:
      "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
  },
};

export const calloutBoxBlock: ComponentConfig<CalloutBoxProps> = {
  label: "Callout Box",
  fields: {
    variant: {
      type: "radio",
      label: "Type",
      options: [
        { label: "Note", value: "note" },
        { label: "Tip", value: "tip" },
        { label: "Important", value: "important" },
      ],
      metadata: { help: "Note is quiet background info, Tip is a helpful shortcut, Important is something readers must act on. Use Important sparingly." },
    },
    label: { type: "text", label: "Label", metadata: { help: "Text shown before the message. Leave blank to use the type name (Note, Tip or Important)." } },
    title: { type: "text", label: "Title", metadata: { help: "Optional bold first line. Leave blank to hide it." } },
    body: { type: "textarea", label: "Message", metadata: { help: "Keep it to a few sentences. Blank lines start a new paragraph." } },
    linkLabel: { type: "text", label: "Link text", metadata: { help: "Say where it goes. Leave blank to hide the link." } },
    linkHref: { type: "text", label: "Link" },
    width: {
      type: "radio",
      label: "Width",
      options: [
        { label: "Text column", value: "prose" },
        { label: "Wide", value: "wide" },
      ],
      metadata: { help: "Text column lines up with article text; wide matches full-width sections." },
    },
  },
  defaultProps: {
    variant: "important",
    label: "",
    title: "Bring proof of residency to your appointment",
    body: "A current utility bill, lease or property tax statement with your name and a city address is required for resident rates. Without it we'll book you at the non-resident rate and refund the difference once you show proof.",
    linkLabel: "What counts as proof of residency",
    linkHref: "/residency",
    width: "prose",
  },
  render: ({ variant, label, title, body, linkLabel, linkHref, width }) => {
    const v = variants[variant] ?? variants.note;
    const prefix = label?.trim() || v.defaultLabel;
    const paragraphs = (body || "").split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean);
    if (!title && paragraphs.length === 0) return <></>;

    return (
      <div className="px-4 py-6 sm:px-6 lg:px-8">
        <div
          role="note"
          aria-label={prefix}
          className={`relative mx-auto flex gap-4 overflow-hidden rounded-2xl py-5 pr-5 pl-6 sm:gap-5 sm:py-6 sm:pr-8 sm:pl-8 ${v.box} ${width === "wide" ? "max-w-7xl" : "max-w-3xl"}`}
        >
          <span aria-hidden="true" className={`absolute inset-y-0 left-0 w-1 ${v.rule}`} />
          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className={`mt-0.5 size-5 shrink-0 ${v.icon}`}>
            <path fillRule="evenodd" d={v.iconPath} clipRule="evenodd" />
          </svg>
          <div className="min-w-0 flex-1">
            <p className={`text-xs font-semibold tracking-widest uppercase ${v.label}`}>
              {prefix}
              <span className="sr-only">:</span>
            </p>
            {title ? <p className={`mt-1.5 text-base font-semibold text-pretty sm:text-lg ${v.title}`}>{title}</p> : null}
            {paragraphs.length > 0 ? (
              <div className={`mt-2 space-y-3 text-base leading-7 text-pretty ${v.body}`}>
                {paragraphs.map((p, i) => (
                  <p key={i}>{p}</p>
                ))}
              </div>
            ) : null}
            {linkLabel ? (
              <p className="mt-3">
                <a
                  href={linkHref || "#"}
                  className={`group inline-flex min-h-11 items-center gap-1.5 rounded-sm text-sm font-semibold underline underline-offset-4 focus-visible:outline-2 focus-visible:outline-offset-2 ${v.link}`}
                >
                  {linkLabel}
                  <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-4 transition group-hover:translate-x-0.5">
                    <path fillRule="evenodd" d="M2 8a.75.75 0 0 1 .75-.75h8.69L8.22 4.03a.75.75 0 0 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06-1.06l3.22-3.22H2.75A.75.75 0 0 1 2 8Z" clipRule="evenodd" />
                  </svg>
                </a>
              </p>
            ) : null}
          </div>
        </div>
      </div>
    );
  },
};
```
