# Add the "Search Hero" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/hero-search) to this Pantheon Content Publisher (P1) Next.js project. Portal front door with one large GET search box and popular-search links, built for city and campus sites.

## Steps

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

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

/**
 * Hero (Search) — a portal front door: headline, one big site-search box that submits
 * with GET to your search page, and popular searches beneath. Built for city and campus sites.
 * Register: `HeroSearchBlock: heroSearchBlock` in puck.config.tsx.
 */

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

export type HeroSearchProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  searchAction: string;
  searchParam: string;
  inputLabel: string;
  placeholder: string;
  buttonLabel: string;
  popularLabel: string;
  popular: { label: string; href: string }[];
};

export const heroSearchBlock: ComponentConfig<HeroSearchProps> = {
  label: "Hero (Search)",
  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" },
    searchAction: { type: "text", label: "Search page URL", metadata: { help: "The page that shows results, like /search. The form opens it with the search words added to the address." } },
    searchParam: { type: "text", label: "Search parameter name", metadata: { help: "The query name your search page reads, usually q or s. /search?q=trash+pickup uses q." } },
    inputLabel: { type: "text", label: "Search field label", metadata: { help: "Read by screen readers. It isn't shown on the page." } },
    placeholder: { type: "text", label: "Placeholder", metadata: { help: "Example text inside the empty field." } },
    buttonLabel: { type: "text", label: "Button text" },
    popularLabel: { type: "text", label: "Popular searches label", metadata: { help: "Shown before the links under the search box." } },
    popular: {
      type: "array",
      label: "Popular searches",
      min: 0,
      max: 8,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "Pay a bill", href: "/pay" },
      arrayFields: {
        label: { type: "text", label: "Text" },
        href: { type: "text", label: "Link", metadata: { help: "Link straight to the page, or to /search?q=… for a canned search." } },
      },
    },
  },
  defaultProps: {
    eyebrow: "City of Maple Falls",
    heading: "How can we help you today?",
    headingLevel: "h1",
    body: "Find services, pay bills, report a problem or look up a city department. Most requests can be finished online in a few minutes.",
    searchAction: "/search",
    searchParam: "q",
    inputLabel: "Search city services",
    placeholder: "Try “trash pickup” or “building permit”",
    buttonLabel: "Search",
    popularLabel: "Popular",
    popular: [
      { label: "Pay a water bill", href: "/utilities/pay" },
      { label: "Trash & recycling schedule", href: "/sanitation/schedule" },
      { label: "Report a pothole", href: "/311/pothole" },
      { label: "Building permits", href: "/permits" },
      { label: "Council meetings", href: "/council/meetings" },
    ],
  },
  render: ({ id, eyebrow, heading, headingLevel, body, searchAction, searchParam, inputLabel, placeholder, buttonLabel, popularLabel, popular }) => {
    const H = headingLevel || "h1";
    const uid = `p1-hero-search-${id}`;
    const links = (popular ?? []).filter((l) => l?.label);
    return (
      <section className="relative isolate overflow-hidden bg-indigo-950 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-28">
        <svg aria-hidden="true" viewBox="0 0 800 400" preserveAspectRatio="xMidYMid slice" fill="none" className="absolute inset-0 -z-10 size-full text-indigo-400/15">
          <path d="M-50 330c120-40 200 30 330-10s180-120 320-90 160 60 250 40" stroke="currentColor" strokeWidth="1.5" />
          <path d="M-50 290c120-40 200 30 330-10s180-120 320-90 160 60 250 40" stroke="currentColor" strokeWidth="1.5" />
          <path d="M-50 250c120-40 200 30 330-10s180-120 320-90 160 60 250 40" stroke="currentColor" strokeWidth="1.5" />
          <path d="M-50 210c120-40 200 30 330-10s180-120 320-90 160 60 250 40" stroke="currentColor" strokeWidth="1.5" />
          <path d="M-50 170c120-40 200 30 330-10s180-120 320-90 160 60 250 40" stroke="currentColor" strokeWidth="1.5" />
          <path d="M-50 130c120-40 200 30 330-10s180-120 320-90 160 60 250 40" stroke="currentColor" strokeWidth="1.5" />
        </svg>
        <div aria-hidden="true" className="absolute inset-x-0 bottom-0 -z-10 h-1/2 bg-linear-to-t from-indigo-950 to-indigo-950/0" />

        <div className="mx-auto max-w-3xl text-center">
          {eyebrow ? <p className="text-sm font-semibold tracking-widest text-indigo-200 uppercase">{eyebrow}</p> : null}
          {heading ? (
            <H className={`${eyebrow ? "mt-4" : ""} text-4xl font-semibold tracking-tight text-balance text-white sm:text-6xl`}>{heading}</H>
          ) : null}
          {body ? <p className="mx-auto mt-6 max-w-2xl text-lg leading-8 text-pretty text-indigo-100">{body}</p> : null}

          <form role="search" action={searchAction || "/search"} method="get" className="mx-auto mt-10 max-w-2xl">
            <label htmlFor={`${uid}-q`} className="sr-only">
              {inputLabel || "Search"}
            </label>
            <div className="flex flex-col gap-2 rounded-2xl bg-white p-2 shadow-2xl ring-1 ring-white/10 sm:flex-row sm:items-center">
              <div className="relative min-w-0 flex-1">
                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="pointer-events-none absolute top-1/2 left-3 size-6 -translate-y-1/2 text-neutral-500">
                  <path fillRule="evenodd" d="M9 3.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11ZM2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Z" clipRule="evenodd" />
                </svg>
                <input
                  id={`${uid}-q`}
                  type="search"
                  name={searchParam || "q"}
                  required
                  autoComplete="off"
                  enterKeyHint="search"
                  placeholder={placeholder || undefined}
                  className="block min-h-14 w-full rounded-xl border-0 bg-transparent py-3 pr-3 pl-12 text-lg text-neutral-950 placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-600 focus:outline-none"
                />
              </div>
              <button
                type="submit"
                className="inline-flex min-h-14 shrink-0 items-center justify-center rounded-xl bg-indigo-600 px-7 text-base font-semibold text-white transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
              >
                {buttonLabel || "Search"}
              </button>
            </div>
          </form>

          {links.length ? (
            <nav aria-label={popularLabel || "Popular searches"} className="mx-auto mt-6 flex max-w-2xl flex-wrap items-center justify-center gap-2">
              {popularLabel ? <span className="mr-1 text-sm font-medium text-indigo-200">{popularLabel}:</span> : null}
              {links.map((l, i) => (
                <a
                  key={`${l.label}-${i}`}
                  href={l.href || "#"}
                  className="inline-flex min-h-11 items-center rounded-full bg-white/10 px-4 text-sm font-medium text-white ring-1 ring-white/15 transition ring-inset hover:bg-white/20 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                >
                  {l.label}
                </a>
              ))}
            </nav>
          ) : null}
        </div>
      </section>
    );
  },
};
```
