# Add the "Long-form Text" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/long-form-text) to this Pantheon Content Publisher (P1) Next.js project. Editorial prose at a comfortable measure with a lead, drop cap, placed pull quote and side note.

## Steps

1. Create `components/puck/long-form-text-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 { longFormTextBlock } from "./components/puck/long-form-text-block";`
3. Register it under `components` as `LongFormTextBlock: longFormTextBlock`.
4. Add `"LongFormTextBlock"` 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/long-form-text-block.tsx`

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

/**
 * Long-form Text — an editorial prose block set to a comfortable reading measure: heading,
 * lead paragraph, body with an optional drop cap, a pull quote placed between paragraphs and a side note.
 * Register: `LongFormTextBlock: longFormTextBlock` in puck.config.tsx.
 */

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

export type LongFormTextProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  byline: string;
  lead: string;
  body: string;
  dropCap: boolean;
  pullQuote: string;
  pullQuoteCite: string;
  pullQuoteAfter: "1" | "2" | "3" | "4" | "5";
  sideNoteTitle: string;
  sideNote: string;
};

/** Blank lines start paragraphs; a block whose every line starts with "- " becomes a bulleted list. */
function toBlocks(text: string) {
  return (text || "")
    .split(/\n\s*\n/)
    .map((b) => b.trim())
    .filter(Boolean)
    .map((block) => {
      const lines = block.split("\n").map((l) => l.trim()).filter(Boolean);
      return lines.every((l) => /^[-*•]\s+/.test(l))
        ? { kind: "list" as const, items: lines.map((l) => l.replace(/^[-*•]\s+/, "")) }
        : { kind: "para" as const, text: block };
    });
}

export const longFormTextBlock: ComponentConfig<LongFormTextProps> = {
  label: "Long-form Text",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. Leave blank to hide it." } },
    heading: { type: "textarea", label: "Heading", metadata: { help: "Leave blank when this continues a story started above." } },
    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." },
    },
    byline: { type: "text", label: "Byline", metadata: { help: "Author and date, like “By Ana Ortiz · May 2026”. Leave blank to hide it." } },
    lead: { type: "textarea", label: "Lead paragraph", metadata: { help: "A larger opening paragraph that sets up the piece. Leave blank to hide it." } },
    body: {
      type: "textarea",
      label: "Body",
      metadata: { help: "Blank lines start a new paragraph. Start each line of a block with “- ” to make a bulleted list." },
    },
    dropCap: {
      type: "radio",
      label: "Drop cap",
      options: [
        { label: "On", value: true },
        { label: "Off", value: false },
      ],
      metadata: { help: "Enlarges the first letter of the body. Best for feature stories." },
    },
    pullQuote: { type: "textarea", label: "Pull quote", metadata: { help: "A short, striking line from the piece. Leave blank to hide it." } },
    pullQuoteCite: { type: "text", label: "Pull quote source", metadata: { help: "Who said it, like “Rosa Delgado, garden volunteer”. Leave blank to hide it." } },
    pullQuoteAfter: {
      type: "select",
      label: "Place pull quote after",
      options: [
        { label: "Paragraph 1", value: "1" },
        { label: "Paragraph 2", value: "2" },
        { label: "Paragraph 3", value: "3" },
        { label: "Paragraph 4", value: "4" },
        { label: "Paragraph 5", value: "5" },
      ],
      metadata: { help: "If the body is shorter, the quote goes at the end." },
    },
    sideNoteTitle: { type: "text", label: "Side note title", metadata: { help: "Shown beside the text on wide screens and after it on phones." } },
    sideNote: { type: "textarea", label: "Side note", metadata: { help: "Context, a definition or a related link in plain text. Leave blank to hide the side note." } },
  },
  defaultProps: {
    eyebrow: "Community stories",
    heading: "The garden that grew a neighborhood back together",
    headingLevel: "h2",
    byline: "By Ana Ortiz · Photos by Marcus Lee · May 2026",
    lead: "Six years ago the corner of Fifth and Locust was a fenced lot full of broken concrete. Today it feeds forty families, hosts a Saturday market and has a waiting list for plots.",
    body: "It started with a petition taped to a laundromat window. Rosa Delgado, who had grown peppers on her fire escape for twenty years, wanted somewhere to put them in the ground. Within a month she had 212 signatures and a meeting with the city's vacant land office.\n\nThe city agreed to a five-year lease for one dollar a year, on the condition that neighbors cleared the lot themselves. Over three weekends, more than a hundred volunteers hauled out eleven dumpsters of debris. A local contractor donated topsoil; the high school's shop class built the raised beds.\n\nThe first season was messy. Tomatoes split in a July heat wave, someone's squash took over three neighboring plots, and the water line froze in October. But the harvest dinner that fall drew more people than the lot could hold.\n\nNow the garden runs on a simple set of rules the members wrote together:\n\n- Every plot holder works two shared hours a month\n- A quarter of every harvest goes to the corner food pantry\n- Kids from the after-school program tend their own beds\n\nThis spring the city made the lease permanent. Rosa still has the first plot by the gate, and she still grows peppers.",
    dropCap: true,
    pullQuote: "Nobody here was waiting for permission anymore. We just needed a place to start.",
    pullQuoteCite: "Rosa Delgado, founding member",
    pullQuoteAfter: "2",
    sideNoteTitle: "Start a garden on your block",
    sideNote: "The Vacant Land Program leases city-owned lots to resident groups for community gardens. Applications open each January, and staff help with soil testing and water hookups.",
  },
  render: ({ eyebrow, heading, headingLevel, byline, lead, body, dropCap, pullQuote, pullQuoteCite, pullQuoteAfter, sideNoteTitle, sideNote }) => {
    const H = headingLevel || "h2";
    const blocks = toBlocks(body);
    const after = Math.min(Math.max(Number(pullQuoteAfter) || 2, 1), Math.max(blocks.length, 1));
    const firstParaIndex = blocks.findIndex((b) => b.kind === "para");
    const hasSide = Boolean(sideNote?.trim());
    const hasHeader = Boolean(eyebrow || heading || byline);

    const quote = pullQuote ? (
      <figure className="my-12 border-y border-neutral-200 py-10 sm:my-14 lg:border-0 lg:py-4 xl:-mx-12">
        <blockquote className="font-serif text-2xl leading-snug font-normal tracking-tight text-balance text-neutral-950 italic sm:text-3xl sm:leading-snug">
          <p>
            <span aria-hidden="true" className="mr-1 text-indigo-600">
              “
            </span>
            {pullQuote}
            <span aria-hidden="true" className="text-indigo-600">
              ”
            </span>
          </p>
        </blockquote>
        {pullQuoteCite ? (
          <figcaption className="mt-5 flex items-center gap-3 text-sm font-medium text-neutral-600">
            <span aria-hidden="true" className="h-px w-8 bg-indigo-600" />
            {pullQuoteCite}
          </figcaption>
        ) : null}
      </figure>
    ) : null;

    if (!hasHeader && !lead && blocks.length === 0 && !pullQuote && !hasSide) return <></>;

    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 grid max-w-6xl grid-cols-1 gap-12 lg:grid-cols-12 lg:gap-x-16">
          <article className={hasSide ? "lg:col-span-8" : "lg:col-span-8 lg:col-start-3"}>
            <div className="mx-auto max-w-prose lg:mx-0">
              {hasHeader ? (
                <header>
                  {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{eyebrow}</p> : null}
                  {heading ? (
                    <H className={`${eyebrow ? "mt-4" : ""} font-serif text-4xl leading-tight font-normal tracking-tight text-balance text-neutral-950 sm:text-5xl sm:leading-tight`}>
                      {heading}
                    </H>
                  ) : null}
                  {byline ? <p className="mt-5 text-sm text-neutral-600">{byline}</p> : null}
                </header>
              ) : null}

              {lead ? (
                <p className={`${hasHeader ? "mt-10 border-t border-neutral-200 pt-10" : ""} text-xl leading-9 text-pretty text-neutral-800 sm:text-2xl sm:leading-10`}>
                  {lead}
                </p>
              ) : null}

              {blocks.length > 0 || quote ? (
                <div className={`${hasHeader || lead ? "mt-8" : ""} text-lg leading-8 text-pretty text-neutral-700`}>
                  {blocks.map((b, i) => (
                    <div key={i} className={i > 0 ? "mt-6" : undefined}>
                      {b.kind === "list" ? (
                        <ul role="list" className="space-y-3 border-l-2 border-indigo-100 pl-6">
                          {b.items.map((item, j) => (
                            <li key={j}>{item}</li>
                          ))}
                        </ul>
                      ) : (
                        <p
                          className={
                            dropCap && i === firstParaIndex
                              ? "first-letter:float-left first-letter:mt-1 first-letter:mr-3 first-letter:font-serif first-letter:text-7xl first-letter:leading-14 first-letter:text-indigo-700"
                              : undefined
                          }
                        >
                          {b.text}
                        </p>
                      )}
                      {i + 1 === after ? quote : null}
                    </div>
                  ))}
                  {blocks.length === 0 ? quote : null}
                </div>
              ) : null}
            </div>
          </article>

          {hasSide ? (
            <aside aria-label={sideNoteTitle || "Side note"} className="lg:col-span-4">
              <div className="mx-auto max-w-prose rounded-2xl bg-neutral-50 p-6 ring-1 ring-neutral-950/5 sm:p-8 lg:sticky lg:top-24 lg:mx-0 lg:mt-48">
                <p className="text-xs font-semibold tracking-widest text-indigo-700 uppercase">Side note</p>
                {sideNoteTitle ? <p className="mt-3 text-lg font-semibold text-pretty text-neutral-950">{sideNoteTitle}</p> : null}
                <div className="mt-3 space-y-3 text-base leading-7 text-pretty text-neutral-600">
                  {sideNote
                    .split(/\n\s*\n/)
                    .map((p) => p.trim())
                    .filter(Boolean)
                    .map((p, i) => (
                      <p key={i}>{p}</p>
                    ))}
                </div>
              </div>
            </aside>
          ) : null}
        </div>
      </section>
    );
  },
};
```
