# Add the "Image Overlay Hero" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/hero-image-overlay) to this Pantheon Content Publisher (P1) Next.js project. Full-bleed photo with an adjustable gradient scrim, headline and buttons anchored bottom-left, and an optional photo credit.

## Steps

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

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

/**
 * Hero (Image Overlay) — a full-bleed photograph with a gradient scrim and the headline
 * anchored bottom-left, plus an optional photo credit. Register:
 * `HeroImageOverlayBlock: heroImageOverlayBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Scrim = "light" | "medium" | "strong";

export type HeroImageOverlayProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  primaryLabel: string;
  primaryHref: string;
  secondaryLabel: string;
  secondaryHref: string;
  imageUrl: string;
  imageAlt: string;
  credit: string;
  scrim: Scrim;
};

// Every strength keeps the bottom-left text zone near-opaque so white copy passes AA on any photo.
const SCRIMS: Record<Scrim, { base: string; side: string }> = {
  light: {
    base: "bg-linear-to-t from-neutral-950/90 via-neutral-950/40 to-neutral-950/0",
    side: "lg:bg-linear-to-r lg:from-neutral-950/50 lg:to-neutral-950/0",
  },
  medium: {
    base: "bg-linear-to-t from-neutral-950/95 via-neutral-950/60 to-neutral-950/15",
    side: "lg:bg-linear-to-r lg:from-neutral-950/60 lg:to-neutral-950/0",
  },
  strong: {
    base: "bg-linear-to-t from-neutral-950 via-neutral-950/75 to-neutral-950/40",
    side: "lg:bg-linear-to-r lg:from-neutral-950/70 lg:to-neutral-950/10",
  },
};

const ARROW = "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";

export const heroImageOverlayBlock: ComponentConfig<HeroImageOverlayProps> = {
  label: "Hero (Image Overlay)",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. Leave blank to hide it." } },
    heading: { type: "textarea", label: "Heading" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1 (page title)", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Use H1 when this hero is the top of the page. The look doesn't change." },
    },
    body: { type: "textarea", label: "Body" },
    primaryLabel: { type: "text", label: "Primary button text" },
    primaryHref: { type: "text", label: "Primary button link", metadata: { help: "A path (/donate), full URL, #anchor, mailto: or tel:." } },
    secondaryLabel: { type: "text", label: "Secondary link text", metadata: { help: "Leave blank to hide it." } },
    secondaryHref: { type: "text", label: "Secondary link" },
    imageUrl: { type: "text", label: "Image URL", metadata: { help: "Use a wide photo, at least 2000px across. The bottom-left corner sits under the text." } },
    imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for screen reader users. Leave blank only if it's purely decorative." } },
    credit: { type: "text", label: "Photo credit", metadata: { help: "Shown small in the bottom-right corner. Leave blank to hide it." } },
    scrim: {
      type: "select",
      label: "Scrim strength",
      options: [
        { label: "Light", value: "light" },
        { label: "Medium", value: "medium" },
        { label: "Strong", value: "strong" },
      ],
      metadata: { help: "How much the photo darkens behind the text. Use Strong for bright or busy photos." },
    },
  },
  defaultProps: {
    eyebrow: "Riverfront Conservancy",
    heading: "Eight miles of river, open to everyone",
    headingLevel: "h1",
    body: "Trails, boat launches and wetland boardwalks restored by thousands of volunteers, and free to visit from dawn to dusk every day of the year.",
    primaryLabel: "Plan your visit",
    primaryHref: "/visit",
    secondaryLabel: "Volunteer with us",
    secondaryHref: "/volunteer",
    imageUrl: "https://picsum.photos/seed/riverbend/2400/1500",
    imageAlt: "A wide river bending through wooded banks at sunrise",
    credit: "Photo: Dana Whitfield",
    scrim: "medium",
  },
  render: ({ eyebrow, heading, headingLevel, body, primaryLabel, primaryHref, secondaryLabel, secondaryHref, imageUrl, imageAlt, credit, scrim }) => {
    const H = headingLevel || "h1";
    const s = SCRIMS[scrim] ?? SCRIMS.medium;
    return (
      <section className="relative isolate flex min-h-144 items-end overflow-hidden bg-neutral-900 px-4 pt-40 pb-16 sm:px-6 sm:pb-20 lg:min-h-176 lg:px-8 lg:pb-24">
        {imageUrl ? <img src={imageUrl} alt={imageAlt || ""} className="absolute inset-0 -z-20 size-full object-cover" /> : null}
        <div aria-hidden="true" className={`absolute inset-0 -z-10 ${s.base}`} />
        <div aria-hidden="true" className={`absolute inset-0 -z-10 ${s.side}`} />

        <div className="mx-auto w-full max-w-7xl">
          <div className="max-w-2xl">
            {eyebrow ? (
              <p className="flex items-center gap-3 text-sm font-semibold tracking-widest text-white uppercase">
                <span aria-hidden="true" className="h-px w-8 bg-indigo-400" />
                {eyebrow}
              </p>
            ) : null}
            {heading ? (
              <H className={`${eyebrow ? "mt-5" : ""} text-4xl font-semibold tracking-tight text-balance text-white sm:text-6xl lg:text-7xl`}>{heading}</H>
            ) : null}
            {body ? <p className="mt-6 max-w-xl text-lg leading-8 text-pretty text-neutral-200">{body}</p> : null}
            {primaryLabel || secondaryLabel ? (
              <div className="mt-8 flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6">
                {primaryLabel ? (
                  <a
                    href={primaryHref || "#"}
                    className="inline-flex min-h-11 items-center justify-center rounded-lg bg-white px-5 py-3 text-base font-semibold text-neutral-950 shadow-sm transition hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                  >
                    {primaryLabel}
                  </a>
                ) : null}
                {secondaryLabel ? (
                  <a
                    href={secondaryHref || "#"}
                    className="group inline-flex min-h-11 items-center justify-center gap-1.5 rounded-lg px-1 text-base font-semibold text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                  >
                    {secondaryLabel}
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 transition group-hover:translate-x-0.5">
                      <path fillRule="evenodd" d={ARROW} clipRule="evenodd" />
                    </svg>
                  </a>
                ) : null}
              </div>
            ) : null}
          </div>
        </div>

        {credit ? <p className="absolute right-4 bottom-4 max-w-xs truncate text-xs text-neutral-300 sm:right-6 lg:right-8">{credit}</p> : null}
      </section>
    );
  },
};
```
