# Add the "Book Club" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/book-club) to this Pantheon Content Publisher (P1) Next.js project. This month's book club pick with cover, discussion details, copy pickup note, discussion questions and upcoming picks.

## Steps

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

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

/**
 * Book Club — this month's pick: cover, title and author, discussion date/time/place, a note
 * about borrowing copies, discussion questions in a native <details>, and upcoming picks.
 * Register: `BookClubBlock: bookClubBlock` in puck.config.tsx.
 */

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

type Pick = { month: string; title: string; author: string; href: string };

export type BookClubProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  bookTitle: string;
  bookAuthor: string;
  blurb: string;
  coverUrl: string;
  coverAlt: string;
  date: string;
  dateIso: string;
  time: string;
  place: string;
  copiesNote: string;
  questionsSummary: string;
  questions: { question: string }[];
  rsvpLabel: string;
  rsvpHref: string;
  upcomingHeading: string;
  upcoming: Pick[];
};

const childLevel = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;
const isoPattern = /^\d{4}-\d{2}-\d{2}/;
const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

export const bookClubBlock: ComponentConfig<BookClubProps> = {
  label: "Book Club",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Such as the club's name. Leave blank to hide it." } },
    heading: { type: "text", label: "Heading" },
    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." },
    },
    intro: { type: "textarea", label: "Intro", metadata: { help: "Leave blank to hide it." } },
    bookTitle: { type: "text", label: "Book title" },
    bookAuthor: { type: "text", label: "Author" },
    blurb: { type: "textarea", label: "About the book", metadata: { help: "Two or three sentences. Leave blank to hide it." } },
    coverUrl: { type: "text", label: "Cover image URL", metadata: { help: "Leave blank to show a typeset cover with the title." } },
    coverAlt: { type: "text", label: "Cover alt text", metadata: { help: "Usually blank, since the title is right beside it." } },
    date: { type: "text", label: "Discussion date", metadata: { help: "As it should appear, such as Thursday, November 12." } },
    dateIso: { type: "text", label: "Discussion date (YYYY-MM-DD)", metadata: { help: "For calendars and screen readers. Optional." } },
    time: { type: "text", label: "Time" },
    place: { type: "text", label: "Place", metadata: { help: "Branch and room, or Online." } },
    copiesNote: { type: "textarea", label: "Borrowing copies note", metadata: { help: "How to get a copy, such as kits at the desk. Leave blank to hide it." } },
    questionsSummary: { type: "text", label: "Questions toggle text" },
    questions: {
      type: "array",
      label: "Discussion questions",
      min: 0,
      max: 12,
      getItemSummary: (item) => item?.question?.slice(0, 48) || "Question",
      defaultItemProps: { question: "New question" },
      arrayFields: { question: { type: "textarea", label: "Question" } },
    },
    rsvpLabel: { type: "text", label: "Button text", metadata: { help: "Such as RSVP or Join the club. Leave blank to hide it." } },
    rsvpHref: { type: "text", label: "Button link" },
    upcomingHeading: { type: "text", label: "Upcoming heading" },
    upcoming: {
      type: "array",
      label: "Upcoming picks",
      min: 0,
      max: 8,
      getItemSummary: (item) => [item?.month, item?.title].filter(Boolean).join(" · ") || "Pick",
      defaultItemProps: { month: "Month", title: "Book title", author: "Author", href: "" },
      arrayFields: {
        month: { type: "text", label: "Month" },
        title: { type: "text", label: "Title" },
        author: { type: "text", label: "Author" },
        href: { type: "text", label: "Catalog link", metadata: { help: "Leave blank for no link." } },
      },
    },
  },
  defaultProps: {
    eyebrow: "Cedar Valley Readers · Monthly book club",
    heading: "This month we're reading",
    headingLevel: "h2",
    intro: "",
    bookTitle: "The Orchard Keeper's Daughter",
    bookAuthor: "Mara Ellison",
    blurb: "Three generations of women hold on to a failing apple orchard through one hard winter. A quiet, generous novel about land, inheritance and the stories families choose to keep.",
    coverUrl: "",
    coverAlt: "",
    date: "Thursday, November 12",
    dateIso: "2026-11-12",
    time: "6:30–7:45 p.m.",
    place: "Main Library, Reading Room (2nd floor)",
    copiesNote: "Book club kits with 10 copies, including large print and audiobook, are at the Main Library front desk starting October 15. No card needed to borrow a club copy.",
    questionsSummary: "Discussion questions",
    questions: [
      { question: "The orchard is almost a character of its own. How does it change from the first chapter to the last?" },
      { question: "Ruth keeps her mother's letters secret for most of the book. Was she right to?" },
      { question: "Which of the three women did you understand best, and which surprised you?" },
      { question: "What does the book suggest we owe the people who come after us?" },
    ],
    rsvpLabel: "RSVP for the discussion",
    rsvpHref: "/events/book-club-november",
    upcomingHeading: "Coming up",
    upcoming: [
      { month: "December", title: "Small Rivers", author: "Theo Okafor", href: "/catalog/record/1002" },
      { month: "January", title: "How Cities Remember", author: "Priya Natarajan", href: "/catalog/record/1006" },
      { month: "February", title: "The Lighthouse at Gray Point", author: "June Halvorsen", href: "/catalog/record/1004" },
    ],
  },
  render: ({ eyebrow, heading, headingLevel, intro, bookTitle, bookAuthor, blurb, coverUrl, coverAlt, date, dateIso, time, place, copiesNote, questionsSummary, questions, rsvpLabel, rsvpHref, upcomingHeading, upcoming }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const qList = (questions ?? []).filter((q) => q?.question);
    const picks = (upcoming ?? []).filter((p) => p?.title);
    const iso = isoPattern.test(dateIso || "") ? dateIso.slice(0, 10) : "";
    const hasWhen = Boolean(date || time || place);

    return (
      <section className="bg-neutral-50 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-6xl">
          <div className="grid grid-cols-1 gap-10 md:grid-cols-12 md:gap-12 lg:gap-16">
            <div className="md:col-span-5 lg:col-span-4">
              <div className="relative mx-auto w-56 sm:w-64 md:w-full md:max-w-xs">
                <div aria-hidden="true" className="absolute inset-0 translate-x-3 translate-y-3 rounded-r-lg rounded-l-sm bg-indigo-200" />
                <div className="relative aspect-2/3 overflow-hidden rounded-r-lg rounded-l-sm shadow-xl ring-1 ring-neutral-950/10">
                  {coverUrl ? (
                    <img src={coverUrl} alt={coverAlt || ""} className="size-full object-cover" />
                  ) : (
                    <div aria-hidden="true" className="flex size-full flex-col justify-between bg-indigo-900 p-6 text-white">
                      <span className="text-xs font-medium tracking-widest text-indigo-200 uppercase">A novel</span>
                      <div>
                        <span className="block h-0.5 w-10 bg-indigo-300" />
                        <span className="mt-4 block font-serif text-2xl leading-tight font-semibold text-balance break-words">{bookTitle || "This month's book"}</span>
                      </div>
                      <span className="text-sm font-medium tracking-wide text-indigo-100">{bookAuthor}</span>
                    </div>
                  )}
                  <span aria-hidden="true" className="absolute inset-y-0 left-0 w-2 bg-linear-to-r from-neutral-950/30 to-transparent" />
                </div>
              </div>
            </div>

            <div className="md:col-span-7 lg:col-span-8">
              {eyebrow ? <p className="text-sm font-semibold text-indigo-700">{eyebrow}</p> : null}
              {heading ? <H className={`${eyebrow ? "mt-2" : ""} text-lg font-medium text-neutral-600`}>{heading}</H> : null}
              {bookTitle ? (
                <p className="mt-2 font-serif text-4xl leading-none font-semibold tracking-tight text-balance text-neutral-950 sm:text-5xl">
                  <cite className="not-italic">{bookTitle}</cite>
                </p>
              ) : null}
              {bookAuthor ? <p className="mt-3 text-lg text-neutral-700">by {bookAuthor}</p> : null}
              {intro ? <p className="mt-4 text-base leading-7 text-pretty text-neutral-600">{intro}</p> : null}
              {blurb ? <p className="mt-5 max-w-2xl text-base leading-7 text-pretty text-neutral-700">{blurb}</p> : null}

              {hasWhen ? (
                <dl className="mt-8 grid grid-cols-1 gap-4 rounded-2xl bg-white p-5 ring-1 ring-neutral-200 sm:grid-cols-3 sm:p-6">
                  {date ? (
                    <div>
                      <dt className="text-xs font-semibold tracking-wide text-neutral-500 uppercase">Date</dt>
                      <dd className="mt-1 text-sm font-semibold text-neutral-950">{iso ? <time dateTime={iso}>{date}</time> : date}</dd>
                    </div>
                  ) : null}
                  {time ? (
                    <div>
                      <dt className="text-xs font-semibold tracking-wide text-neutral-500 uppercase">Time</dt>
                      <dd className="mt-1 text-sm font-semibold text-neutral-950">{time}</dd>
                    </div>
                  ) : null}
                  {place ? (
                    <div>
                      <dt className="text-xs font-semibold tracking-wide text-neutral-500 uppercase">Place</dt>
                      <dd className="mt-1 text-sm font-semibold text-neutral-950">{place}</dd>
                    </div>
                  ) : null}
                </dl>
              ) : null}

              {copiesNote ? (
                <p className="mt-5 flex gap-3 text-sm leading-6 text-pretty text-neutral-700">
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-600">
                    <path d="M10.75 16.82A7.462 7.462 0 0 1 15 15.5c.71 0 1.396.098 2.046.282A.75.75 0 0 0 18 15.06v-11a.75.75 0 0 0-.546-.721A9.006 9.006 0 0 0 15 3a8.963 8.963 0 0 0-4.25 1.065V16.82ZM9.25 4.065A8.963 8.963 0 0 0 5 3c-.85 0-1.673.118-2.454.339A.75.75 0 0 0 2 4.06v11a.75.75 0 0 0 .954.721A7.506 7.506 0 0 1 5 15.5c1.579 0 3.042.487 4.25 1.32V4.065Z" />
                  </svg>
                  <span>{copiesNote}</span>
                </p>
              ) : null}

              {rsvpLabel ? (
                <a
                  href={rsvpHref || "#"}
                  className={`mt-6 inline-flex min-h-11 w-full items-center justify-center rounded-xl bg-indigo-600 px-5 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-500 sm:w-auto ${focusRing}`}
                >
                  {rsvpLabel}
                </a>
              ) : null}

              {qList.length ? (
                <details className="group mt-8 border-y border-neutral-200">
                  <summary className={`flex min-h-12 cursor-pointer list-none items-center justify-between gap-4 rounded-md py-3 text-base font-semibold text-neutral-950 [&::-webkit-details-marker]:hidden ${focusRing}`}>
                    <span>
                      {questionsSummary || "Discussion questions"}
                      <span className="ml-2 text-sm font-normal text-neutral-500 tabular-nums">({qList.length})</span>
                    </span>
                    <span aria-hidden="true" className="grid size-8 place-items-center rounded-full ring-1 ring-neutral-300 transition group-open:rotate-45">
                      <svg viewBox="0 0 20 20" fill="currentColor" className="size-4 text-neutral-600">
                        <path d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" />
                      </svg>
                    </span>
                  </summary>
                  <ol className="space-y-4 pb-6">
                    {qList.map((q, i) => (
                      <li key={i} className="flex gap-4 text-base leading-7 text-pretty text-neutral-700">
                        <span aria-hidden="true" className="font-serif text-xl leading-7 font-semibold text-indigo-600 tabular-nums">
                          {i + 1}
                        </span>
                        <span className="min-w-0">{q.question}</span>
                      </li>
                    ))}
                  </ol>
                </details>
              ) : null}

              {picks.length ? (
                <div className="mt-10">
                  <Sub className="text-sm font-semibold tracking-wide text-neutral-950 uppercase">{upcomingHeading || "Coming up"}</Sub>
                  <ol className="mt-4 divide-y divide-neutral-200 border-t border-neutral-200">
                    {picks.map((p, i) => (
                      <li key={`${p.title}-${i}`} className="flex flex-col gap-1 py-3 sm:flex-row sm:items-baseline sm:gap-6">
                        {p.month ? <span className="w-28 shrink-0 text-sm font-semibold text-indigo-700">{p.month}</span> : null}
                        <span className="min-w-0 text-base text-neutral-950">
                          {p.href ? (
                            <a href={p.href} className={`rounded-sm font-serif font-semibold underline decoration-neutral-300 underline-offset-4 hover:text-indigo-700 hover:decoration-indigo-400 ${focusRing}`}>
                              <cite className="not-italic">{p.title}</cite>
                            </a>
                          ) : (
                            <cite className="font-serif font-semibold not-italic">{p.title}</cite>
                          )}
                          {p.author ? <span className="text-neutral-600"> by {p.author}</span> : null}
                        </span>
                      </li>
                    ))}
                  </ol>
                </div>
              ) : null}
            </div>
          </div>
        </div>
      </section>
    );
  },
};
```
