# Add the "Scholarship List" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/scholarship-list) to this Pantheon Content Publisher (P1) Next.js project. Scholarships sorted by deadline, each with amount, eligibility, a renewable badge and an apply link.

## Steps

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

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

/**
 * Scholarship List — awards with amount, deadline, eligibility and an apply link, sorted
 * soonest deadline first. Renewable awards carry a labeled badge.
 * Register: `ScholarshipListBlock: scholarshipListBlock` in puck.config.tsx.
 */

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

type Scholarship = {
  name: string;
  amount: string;
  amountNote: string;
  deadline: string;
  deadlineIso: string;
  eligibility: string;
  renewable: boolean;
  applyLabel: string;
  applyHref: string;
};

export type ScholarshipListProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  scholarships: Scholarship[];
  footnote: string;
  ctaLabel: string;
  ctaHref: string;
};

const childHeading = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;

const isoPattern = /^\d{4}-\d{2}-\d{2}$/;
const dateFormat = new Intl.DateTimeFormat("en-US", { month: "long", day: "numeric", year: "numeric", timeZone: "UTC" });

function formatIso(iso: string): string {
  const d = new Date(`${iso}T00:00:00Z`);
  return Number.isNaN(d.getTime()) ? iso : dateFormat.format(d);
}

export const scholarshipListBlock: ComponentConfig<ScholarshipListProps> = {
  label: "Scholarship List",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. 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" },
    scholarships: {
      type: "array",
      label: "Scholarships",
      min: 1,
      max: 30,
      getItemSummary: (item) => [item?.name, item?.deadlineIso].filter(Boolean).join(" · ") || "Scholarship",
      defaultItemProps: {
        name: "New scholarship",
        amount: "$1,000",
        amountNote: "per year",
        deadline: "",
        deadlineIso: "2027-02-01",
        eligibility: "First eligibility rule\nSecond eligibility rule",
        renewable: false,
        applyLabel: "Apply",
        applyHref: "/scholarships",
      },
      arrayFields: {
        name: { type: "text", label: "Name" },
        amount: { type: "text", label: "Amount", metadata: { help: "As it should appear, such as $2,500 or Full tuition." } },
        amountNote: { type: "text", label: "Amount note", metadata: { help: "Such as per year or one-time. Leave blank to hide it." } },
        deadlineIso: {
          type: "text",
          label: "Deadline date (YYYY-MM-DD)",
          metadata: { help: "Used to sort the list soonest first and for calendars and screen readers. Awards without a date go last." },
        },
        deadline: {
          type: "text",
          label: "Deadline text (optional)",
          metadata: { help: "Overrides the displayed date, such as March 1, 2027 at 5 p.m. Leave blank to show the date above." },
        },
        eligibility: { type: "textarea", label: "Eligibility", metadata: { help: "One requirement per line." } },
        renewable: {
          type: "radio",
          label: "Renewable",
          options: [
            { label: "Yes", value: true },
            { label: "No", value: false },
          ],
          metadata: { help: "Shows a Renewable badge when the award continues in later years." },
        },
        applyLabel: { type: "text", label: "Apply link text", metadata: { help: "Leave blank to hide the link." } },
        applyHref: { type: "text", label: "Apply link" },
      },
    },
    footnote: { type: "textarea", label: "Footnote", metadata: { help: "Small print under the list. Leave blank to hide it." } },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
    ctaHref: { type: "text", label: "Button link" },
  },
  defaultProps: {
    eyebrow: "Scholarships",
    heading: "Open scholarships for 2027–28",
    headingLevel: "h2",
    intro: "One application in the Northfield Scholarship Portal puts you in consideration for most awards. A few need their own essay or nomination; those are noted below.",
    scholarships: [
      {
        name: "Founders' Merit Scholarship",
        amount: "$6,000",
        amountNote: "per year",
        deadline: "",
        deadlineIso: "2026-12-01",
        eligibility: "Admitted first-year students\nApplication for admission complete by December 1\nNo separate essay required",
        renewable: true,
        applyLabel: "Apply in the portal",
        applyHref: "/scholarships/portal",
      },
      {
        name: "Harlan Public Service Award",
        amount: "$3,500",
        amountNote: "one-time",
        deadline: "",
        deadlineIso: "2027-02-15",
        eligibility: "Sophomores and juniors in any major\n100+ hours of documented community service\nShort essay on a local issue, 500 words",
        renewable: false,
        applyLabel: "Apply",
        applyHref: "/scholarships/harlan-public-service",
      },
      {
        name: "First-Generation Scholars Grant",
        amount: "$4,000",
        amountNote: "per year",
        deadline: "",
        deadlineIso: "2027-01-15",
        eligibility: "Neither parent completed a bachelor's degree\nFAFSA submitted for 2027–28\nEnrolled full time",
        renewable: true,
        applyLabel: "Apply in the portal",
        applyHref: "/scholarships/portal",
      },
      {
        name: "STEM Transfer Pathway Award",
        amount: "$2,500",
        amountNote: "per year",
        deadline: "March 1, 2027 at 5 p.m. Central",
        deadlineIso: "2027-03-01",
        eligibility: "Transferring from a partner community college\nAdmitted to a science, technology, engineering or math major\n3.0 cumulative GPA or higher",
        renewable: true,
        applyLabel: "Apply",
        applyHref: "/scholarships/stem-transfer",
      },
    ],
    footnote: "Amounts are sample figures. Renewable awards continue for up to four years with full-time enrollment and satisfactory academic progress.",
    ctaLabel: "Open the Scholarship Portal",
    ctaHref: "/scholarships/portal",
  },
  render: ({ eyebrow, heading, headingLevel, intro, scholarships, footnote, ctaLabel, ctaHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (scholarships ?? [])
      .filter((s) => s?.name)
      .map((s, i) => ({ ...s, order: i, iso: isoPattern.test((s.deadlineIso || "").trim()) ? s.deadlineIso.trim() : "" }))
      .sort((a, b) => {
        if (a.iso && b.iso) return a.iso < b.iso ? -1 : a.iso > b.iso ? 1 : a.order - b.order;
        if (a.iso) return -1;
        if (b.iso) return 1;
        return a.order - b.order;
      });
    const hasHeader = Boolean(eyebrow || heading || intro || ctaLabel);

    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">
          {hasHeader ? (
            <div className="flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between lg:gap-16">
              <div className="max-w-2xl">
                {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{eyebrow}</p> : null}
                {heading ? (
                  <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl ${eyebrow ? "mt-3" : ""}`}>{heading}</H>
                ) : null}
                {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
              </div>
              {ctaLabel ? (
                <a
                  href={ctaHref || "#"}
                  className="inline-flex min-h-11 shrink-0 items-center justify-center self-start rounded-lg bg-indigo-600 px-5 py-3 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 lg:self-auto"
                >
                  {ctaLabel}
                </a>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ol role="list" className={`space-y-4 ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((s, i) => {
                const rules = (s.eligibility || "")
                  .split("\n")
                  .map((r) => r.trim())
                  .filter(Boolean);
                const shownDeadline = s.deadline || (s.iso ? formatIso(s.iso) : "");
                return (
                  <li key={`${s.name}-${i}`}>
                    <article className="grid grid-cols-1 overflow-hidden rounded-2xl bg-white ring-1 ring-neutral-200 md:grid-cols-12">
                      <div className="flex flex-row items-baseline justify-between gap-4 border-b border-neutral-200 bg-indigo-50/60 px-5 py-4 md:col-span-3 md:flex-col md:items-start md:justify-start md:border-r md:border-b-0 md:px-6 md:py-6">
                        {s.amount ? (
                          <p>
                            <span className="sr-only">Award amount: </span>
                            <span className="block text-3xl font-semibold tracking-tight text-neutral-950 tabular-nums sm:text-4xl">{s.amount}</span>
                            {s.amountNote ? <span className="mt-1 block text-sm text-neutral-600">{s.amountNote}</span> : null}
                          </p>
                        ) : (
                          <span />
                        )}
                        {s.renewable ? (
                          <p className="inline-flex shrink-0 items-center gap-1.5 rounded-full bg-white px-2.5 py-1 text-xs font-semibold text-indigo-800 ring-1 ring-indigo-600/20 ring-inset md:mt-4">
                            <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-3.5">
                              <path fillRule="evenodd" d="M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.932.75.75 0 0 1-1.3-.75 6 6 0 0 1 9.44-1.242l.842.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44 1.241l-.84-.84v1.371a.75.75 0 0 1-1.5 0V9.591a.75.75 0 0 1 .75-.75H5.35a.75.75 0 0 1 0 1.5H3.98l.841.841a4.5 4.5 0 0 0 7.08-.932.75.75 0 0 1 1.025-.273Z" clipRule="evenodd" />
                            </svg>
                            Renewable
                          </p>
                        ) : null}
                      </div>

                      <div className="min-w-0 px-5 py-5 md:col-span-6 md:px-7 md:py-6">
                        <Sub className="text-lg leading-7 font-semibold tracking-tight text-balance text-neutral-950 sm:text-xl">{s.name}</Sub>
                        {rules.length ? (
                          <>
                            <p className="sr-only">Eligibility</p>
                            <ul role="list" className="mt-3 space-y-2">
                              {rules.map((rule, j) => (
                                <li key={j} className="flex gap-2.5 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 fillRule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clipRule="evenodd" />
                                  </svg>
                                  <span className="min-w-0">{rule}</span>
                                </li>
                              ))}
                            </ul>
                          </>
                        ) : null}
                      </div>

                      <div className="flex flex-col gap-4 border-t border-neutral-200 px-5 py-5 sm:flex-row sm:items-center sm:justify-between md:col-span-3 md:flex-col md:items-stretch md:justify-between md:border-t-0 md:px-6 md:py-6">
                        {shownDeadline ? (
                          <p className="text-sm leading-6">
                            <span className="block font-medium text-neutral-600">Deadline</span>
                            {s.iso ? (
                              <time dateTime={s.iso} className="block text-base font-semibold text-neutral-950">
                                {shownDeadline}
                              </time>
                            ) : (
                              <span className="block text-base font-semibold text-neutral-950">{shownDeadline}</span>
                            )}
                          </p>
                        ) : (
                          <span />
                        )}
                        {s.applyLabel ? (
                          <a
                            href={s.applyHref || "#"}
                            className="inline-flex min-h-11 items-center justify-center gap-1.5 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-neutral-950 ring-1 ring-neutral-300 transition ring-inset hover:bg-neutral-50 hover:ring-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                          >
                            {s.applyLabel}
                            <span className="sr-only">: {s.name}</span>
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4">
                              <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}
                      </div>
                    </article>
                  </li>
                );
              })}
            </ol>
          ) : null}

          {footnote ? <p className="mt-8 max-w-3xl text-sm leading-6 text-pretty text-neutral-600">{footnote}</p> : null}
        </div>
      </section>
    );
  },
};
```
