# Add the "Mission & Pillars" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/mission-pillars) to this Pantheon Content Publisher (P1) Next.js project. A large mission statement with an optional vision line and auto-numbered values or program pillars.

## Steps

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

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

/**
 * Mission & Pillars — a large, editorial mission statement with an optional vision line,
 * followed by numbered values or program pillars. Wrap a phrase in *asterisks* to accent it.
 * Register: `MissionPillarsBlock: missionPillarsBlock` in puck.config.tsx.
 */

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

export type MissionPillarsProps = {
  heading: string;
  headingLevel: Heading;
  mission: string;
  visionLabel: string;
  vision: string;
  pillarsLabel: string;
  pillars: { title: string; description: string }[];
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };

const accent = (text: string) =>
  text.split(/(\*[^*\n]+\*)/g).map((part, i) =>
    /^\*[^*\n]+\*$/.test(part) ? (
      <span key={i} className="text-indigo-700">
        {part.slice(1, -1)}
      </span>
    ) : (
      part
    ),
  );

export const missionPillarsBlock: ComponentConfig<MissionPillarsProps> = {
  label: "Mission & Pillars",
  fields: {
    heading: { type: "text", label: "Heading", metadata: { help: "A short label above the statement, like Our mission." } },
    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." },
    },
    mission: { type: "textarea", label: "Mission statement", metadata: { help: "Shown large. Wrap a phrase in *asterisks* to color it, and keep it to one phrase." } },
    visionLabel: { type: "text", label: "Vision label", metadata: { help: "Like Our vision." } },
    vision: { type: "textarea", label: "Vision", metadata: { help: "One sentence describing the future you're working toward. Leave blank to hide it." } },
    pillarsLabel: { type: "text", label: "Pillars label", metadata: { help: "Small line above the pillars, like What guides us. Leave blank to hide it." } },
    pillars: {
      type: "array",
      label: "Pillars",
      min: 0,
      max: 6,
      getItemSummary: (item, i) => item?.title || `Pillar ${(i ?? 0) + 1}`,
      defaultItemProps: { title: "New pillar", description: "One or two sentences on what this means in practice." },
      arrayFields: {
        title: { type: "text", label: "Title" },
        description: { type: "textarea", label: "Description" },
      },
      metadata: { help: "Numbers are added automatically in the order shown." },
    },
  },
  defaultProps: {
    heading: "Our mission",
    headingLevel: "h2",
    mission: "Fernbrook Land Trust protects the forests, farms and creeks of the upper valley *forever*, and keeps them open for every neighbor to walk, work and wonder in.",
    visionLabel: "Our vision",
    vision: "A valley where no one lives more than ten minutes from a trail, and where the land that feeds us is still farmed a hundred years from now.",
    pillarsLabel: "What guides our work",
    pillars: [
      { title: "Permanence", description: "We only take on land we can steward for good, with an endowment set aside for every acre the day we accept it." },
      { title: "Open doors", description: "Our preserves are free, signed in English and Spanish, and built with accessible trails wherever the ground allows." },
      { title: "Working land", description: "Conservation and farming aren't rivals. We lease protected fields to beginning farmers at below-market rates." },
      { title: "Neighbors first", description: "Decisions about a place start with the people who live beside it, through open meetings held before any purchase." },
    ],
  },
  render: ({ heading, headingLevel, mission, visionLabel, vision, pillarsLabel, pillars }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] ?? "h3";
    const list = (pillars ?? []).filter((p) => p?.title || p?.description);
    const cols = list.length === 4 ? "lg:grid-cols-4" : list.length === 2 ? "" : "lg:grid-cols-3";

    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">
          <div className="grid gap-6 lg:grid-cols-12 lg:gap-12">
            {heading ? (
              <div className="lg:col-span-3">
                <H className="flex items-center gap-3 text-sm font-semibold tracking-widest text-neutral-950 uppercase">
                  <span aria-hidden="true" className="h-px w-8 bg-indigo-600" />
                  {heading}
                </H>
              </div>
            ) : null}
            <div className={heading ? "lg:col-span-9" : "lg:col-span-12"}>
              {mission ? (
                <p className="text-3xl leading-tight font-medium tracking-tight text-balance text-neutral-950 sm:text-4xl lg:text-5xl">{accent(mission)}</p>
              ) : null}
              {vision ? (
                <div className="mt-10 grid gap-2 border-l-2 border-indigo-600 pl-5 sm:mt-12 sm:pl-6">
                  {visionLabel ? <p className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{visionLabel}</p> : null}
                  <p className="max-w-2xl text-lg leading-8 text-pretty text-neutral-700 italic sm:text-xl">{vision}</p>
                </div>
              ) : null}
            </div>
          </div>

          {list.length ? (
            <div className="mt-16 sm:mt-20 lg:mt-24">
              {pillarsLabel ? <p className="text-sm font-semibold tracking-wide text-neutral-600">{pillarsLabel}</p> : null}
              <ol role="list" className={`grid gap-x-8 gap-y-10 sm:grid-cols-2 ${cols} ${pillarsLabel ? "mt-6" : ""}`}>
                {list.map((p, i) => (
                  <li key={`${p.title}-${i}`} className="border-t border-neutral-950 pt-6">
                    <p aria-hidden="true" className="text-sm font-semibold text-indigo-700 tabular-nums">
                      {String(i + 1).padStart(2, "0")}
                    </p>
                    {p.title ? <Sub className="mt-4 text-xl font-semibold tracking-tight text-neutral-950">{p.title}</Sub> : null}
                    {p.description ? <p className="mt-3 text-base leading-7 text-pretty text-neutral-600">{p.description}</p> : null}
                  </li>
                ))}
              </ol>
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
