# Add the "Header — Nonprofit" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/header-donate) to this Pantheon Content Publisher (P1) Next.js project. Deep indigo header with a Donate button that stays visible on the smallest phones and a secondary call to action for the people you serve.

## Steps

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

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

/**
 * Header (Nonprofit) — a deep indigo header with a Donate button that stays visible on every
 * screen size, plus a secondary call to action for the people you serve. Phone menu is a native <details>.
 * Register: `HeaderDonateBlock: headerDonateBlock` in puck.config.tsx.
 */

export type HeaderDonateProps = {
  logoText: string;
  logoImageUrl: string;
  logoImageAlt: string;
  logoHref: string;
  navLabel: string;
  links: { label: string; href: string }[];
  currentPath: string;
  secondaryLabel: string;
  secondaryHref: string;
  donateLabel: string;
  donateHref: string;
  menuLabel: string;
};

const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white";

function same(href: string, currentPath: string) {
  const a = (href || "").trim().replace(/\/+$/, "");
  const b = (currentPath || "").trim().replace(/\/+$/, "");
  return Boolean(a) && a === b;
}

const heart = (
  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 text-indigo-600 transition group-hover/donate:scale-110">
    <path d="m9.653 16.915-.005-.003-.019-.01a20.759 20.759 0 0 1-1.162-.682 22.045 22.045 0 0 1-2.582-1.9C4.045 12.733 2 10.352 2 7.5a4.5 4.5 0 0 1 8-2.828A4.5 4.5 0 0 1 18 7.5c0 2.852-2.044 5.233-3.885 6.82a22.049 22.049 0 0 1-3.744 2.582l-.019.01-.005.003h-.002a.739.739 0 0 1-.69.001l-.002-.001Z" />
  </svg>
);

export const headerDonateBlock: ComponentConfig<HeaderDonateProps> = {
  label: "Header (Nonprofit)",
  fields: {
    logoText: { type: "text", label: "Organization name" },
    logoImageUrl: { type: "text", label: "Logo image URL", metadata: { help: "Optional. Use a light (white) version of your logo: the header is dark." } },
    logoImageAlt: {
      type: "text",
      label: "Logo alt text",
      metadata: { help: "Leave blank when the name shows next to the logo, so screen readers don't hear it twice." },
    },
    logoHref: { type: "text", label: "Logo link", metadata: { help: "Usually / for the home page." } },
    navLabel: { type: "text", label: "Navigation name", metadata: { help: "Read by screen readers, like Main. Name each menu on a page differently." } },
    links: {
      type: "array",
      label: "Menu links",
      min: 0,
      max: 6,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "New link", href: "/" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link" },
      },
    },
    currentPath: { type: "text", label: "Current section", metadata: { help: "Optional. A path like /our-work. The matching link is marked as the current page." } },
    secondaryLabel: {
      type: "text",
      label: "Secondary button text",
      metadata: { help: "For the people you serve, like Get help or Find a shelter. It leads the phone menu. Leave blank to hide it." },
    },
    secondaryHref: { type: "text", label: "Secondary button link" },
    donateLabel: { type: "text", label: "Donate button text", metadata: { help: "Always visible, even on the smallest phones. Keep it to one word." } },
    donateHref: { type: "text", label: "Donate button link" },
    menuLabel: { type: "text", label: "Mobile menu label" },
  },
  defaultProps: {
    logoText: "Safe Harbor House",
    logoImageUrl: "",
    logoImageAlt: "",
    logoHref: "/",
    navLabel: "Main",
    links: [
      { label: "Our work", href: "/our-work" },
      { label: "Stories", href: "/stories" },
      { label: "Volunteer", href: "/volunteer" },
      { label: "About", href: "/about" },
    ],
    currentPath: "",
    secondaryLabel: "Get help now",
    secondaryHref: "/help",
    donateLabel: "Donate",
    donateHref: "/donate",
    menuLabel: "Menu",
  },
  render: ({ logoText, logoImageUrl, logoImageAlt, logoHref, navLabel, links, currentPath, secondaryLabel, secondaryHref, donateLabel, donateHref, menuLabel }) => {
    const items = (links ?? []).filter((l) => l?.label);
    const label = navLabel || "Main";
    const hasMenu = items.length > 0 || Boolean(secondaryLabel);

    return (
      <header className="relative z-30 bg-indigo-950">
        <div className="mx-auto flex min-h-16 max-w-7xl items-center justify-between gap-3 px-4 py-2 sm:gap-6 sm:px-6 lg:min-h-20 lg:px-8">
          {logoText || logoImageUrl ? (
            <a href={logoHref || "/"} className={`-m-1.5 inline-flex min-h-11 min-w-0 items-center gap-3 rounded-lg p-1.5 ${focusRing}`}>
              {logoImageUrl ? (
                <img src={logoImageUrl} alt={logoImageAlt || ""} className="h-9 w-auto shrink-0" />
              ) : (
                <svg aria-hidden="true" viewBox="0 0 32 32" className="size-8 shrink-0 text-indigo-300">
                  <path fill="currentColor" d="M16 3 4 10v1.5h24V10L16 3Z" />
                  <path fill="none" stroke="currentColor" strokeWidth="2" d="M7 14v12M12.5 14v12M19.5 14v12M25 14v12" />
                  <path fill="currentColor" d="M3 27h26v2H3z" />
                </svg>
              )}
              {logoText ? <span className="text-base leading-tight font-semibold tracking-tight text-balance text-white sm:text-lg">{logoText}</span> : null}
            </a>
          ) : (
            <span />
          )}

          {items.length ? (
            <nav aria-label={label} className="hidden lg:block">
              <ul role="list" className="flex items-center gap-1">
                {items.map((item, i) => (
                  <li key={`${item.label}-${i}`}>
                    <a
                      href={item.href || "#"}
                      aria-current={same(item.href, currentPath) ? "page" : undefined}
                      className={`inline-flex min-h-11 items-center rounded-full px-4 text-sm font-medium text-indigo-100 transition hover:bg-white/10 hover:text-white aria-[current=page]:bg-white/10 aria-[current=page]:text-white ${focusRing}`}
                    >
                      {item.label}
                    </a>
                  </li>
                ))}
              </ul>
            </nav>
          ) : null}

          <div className="flex shrink-0 items-center gap-2 sm:gap-3">
            {secondaryLabel ? (
              <a
                href={secondaryHref || "#"}
                className={`hidden min-h-11 items-center justify-center rounded-full px-5 text-sm font-semibold text-white ring-1 ring-white/40 ring-inset transition hover:bg-white/10 hover:ring-white md:inline-flex ${focusRing}`}
              >
                {secondaryLabel}
              </a>
            ) : null}
            {donateLabel ? (
              <a
                href={donateHref || "#"}
                className={`group/donate inline-flex min-h-11 items-center justify-center gap-2 rounded-full bg-white px-4 text-sm font-bold text-indigo-950 transition hover:-translate-y-0.5 hover:bg-indigo-50 motion-reduce:transform-none sm:px-5 ${focusRing}`}
              >
                {heart}
                {donateLabel}
              </a>
            ) : null}
            {hasMenu ? (
              <details className="group/menu lg:hidden">
                <summary
                  className={`inline-flex min-h-11 min-w-11 cursor-pointer list-none items-center justify-center gap-2 rounded-full px-3 text-sm font-semibold text-white ring-1 ring-white/40 ring-inset hover:bg-white/10 [&::-webkit-details-marker]:hidden ${focusRing}`}
                >
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 group-open/menu:hidden">
                    <path fillRule="evenodd" d="M2 6.75A.75.75 0 0 1 2.75 6h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 6.75Zm0 6.5a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z" clipRule="evenodd" />
                  </svg>
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="hidden size-5 group-open/menu:block">
                    <path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" />
                  </svg>
                  <span className="sr-only sm:not-sr-only">{menuLabel || "Menu"}</span>
                </summary>
                <div className="absolute inset-x-0 top-full z-40 max-h-svh overflow-y-auto border-t border-white/10 bg-indigo-950 px-4 pt-4 pb-8 shadow-2xl sm:px-6">
                  {secondaryLabel ? (
                    <a
                      href={secondaryHref || "#"}
                      className={`mb-4 flex min-h-12 items-center justify-between rounded-xl bg-white/10 px-4 text-base font-semibold text-white ring-1 ring-white/20 ring-inset hover:bg-white/15 ${focusRing}`}
                    >
                      {secondaryLabel}
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
                        <path fillRule="evenodd" d="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" clipRule="evenodd" />
                      </svg>
                    </a>
                  ) : null}
                  {items.length ? (
                    <nav aria-label={`${label} (mobile)`}>
                      <ul role="list" className="divide-y divide-white/10">
                        {items.map((item, i) => (
                          <li key={`${item.label}-${i}`}>
                            <a
                              href={item.href || "#"}
                              aria-current={same(item.href, currentPath) ? "page" : undefined}
                              className={`flex min-h-12 items-center rounded-lg px-3 text-lg font-medium text-indigo-100 hover:text-white aria-[current=page]:font-semibold aria-[current=page]:text-white ${focusRing}`}
                            >
                              {item.label}
                            </a>
                          </li>
                        ))}
                      </ul>
                    </nav>
                  ) : null}
                </div>
              </details>
            ) : null}
          </div>
        </div>
      </header>
    );
  },
};
```
