{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nonprofit-projects-page",
  "title": "Nonprofit: Projects pages",
  "description": "The projects index, one large card and four smaller ones each with its own drawn scene, and a page per project with its picture and story beside a card that stays in view: funding as a ring, a Donate that carries the project through, and where it is up to. An unknown project renders the 404.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://eased.dev/r/eased-tokens.json",
    "https://eased.dev/r/eased-motion.json",
    "https://eased.dev/r/nonprofit-core.json",
    "https://eased.dev/r/nonprofit-projects.json",
    "https://eased.dev/r/template-core.json",
    "https://eased.dev/r/button.json",
    "https://eased.dev/r/nonprofit-not-found.json"
  ],
  "files": [
    {
      "path": "src/registry/eased/templates/nonprofit/projects-page.tsx",
      "content": "\"use client\";\n\nimport { Button } from \"../../button/button\";\nimport { BaseLink } from \"../_shared/base\";\nimport { ProjectMap } from \"./art\";\nimport { formatMoney, projects, projectsPage, sampleNote, type Project } from \"./content\";\nimport { ProjectArt } from \"./drawings\";\nimport { useGift } from \"./gift\";\nimport { COLUMN, LABEL, LINK, NOTE, PageHead, Reveal } from \"./kit\";\nimport { NotFound } from \"./not-found\";\nimport { fundedOf } from \"./projects\";\n\nconst PINS = projects.map((p) => ({ slug: p.slug, ...p.pin }));\n\n/** A project's funding bar on a sunken track, drawn to its whole percentage. */\nfunction Funded({ project, className = \"h-2\" }: { project: Project; className?: string }) {\n  return (\n    <span aria-hidden className={`relative block w-full overflow-hidden rounded-pill bg-surface-sunken ${className}`}>\n      <span className=\"absolute inset-y-0 left-0 w-full origin-left rounded-pill bg-(--nf-sea)\" style={{ transform: `scaleX(${fundedOf(project) / 100})` }} />\n    </span>\n  );\n}\n\n/** The map with one project's pin lifted, as the picture at the head of its card or page. */\nfunction Picture({ slug, className = \"\" }: { slug: string; className?: string }) {\n  return (\n    <div aria-hidden data-nf-sea=\"\" className={`overflow-hidden bg-bg ${className}`}>\n      <ProjectMap pins={PINS} active={slug} className=\"h-full w-full object-cover\" />\n    </div>\n  );\n}\n\n/** One project as a card: its picture, area, name (the card's link, rule 59), summary on the large one, and its funding. */\nfunction ProjectCard({ p, large = false }: { p: Project; large?: boolean }) {\n  return (\n    <article className=\"group relative flex h-full flex-col overflow-hidden rounded-surface border border-line-subtle bg-surface transition-[border-color,box-shadow] duration-(--eased-duration-standard) ease-standard hover-fine:border-line-strong hover-fine:shadow-raised\">\n      <ProjectArt slug={p.slug} className={`block w-full ${large ? \"aspect-[16/11]\" : \"aspect-[16/8]\"}`} />\n      <div className=\"flex flex-1 flex-col gap-pad-sm p-pad-md\">\n        <p className={LABEL}>\n          {p.area} · {p.kind}\n        </p>\n        <h2 className={`font-display font-semibold tracking-display text-balance text-text ${large ? \"text-display-3xl\" : \"text-display-xl\"}`}>\n          <BaseLink href={`/projects/${p.slug}`} className=\"focus-ring rounded-control-xs after:absolute after:inset-0 after:rounded-surface\">\n            {p.name}\n          </BaseLink>\n        </h2>\n        {large && <p className=\"text-ui-md text-pretty text-text-secondary\">{p.summary}</p>}\n        <div className=\"mt-auto flex flex-col gap-2 pt-pad-xs\">\n          <p className=\"flex items-baseline justify-between gap-pad-base text-ui-sm text-text-secondary tabular-nums\">\n            <span>{projectsPage.raised(formatMoney(p.raised), formatMoney(p.target))}</span>\n            <span className=\"font-medium text-text\">{fundedOf(p)}%</span>\n          </p>\n          <Funded project={p} />\n        </div>\n      </div>\n    </article>\n  );\n}\n\n/**\n * The projects index: the head and a line, then the projects in one grid, the first as a large\n * card down the left and the other four two by two beside it, each with its own drawn scene (a\n * home's filter, a school's tank, tap stands, the clinic tank, a hand pump).\n */\nexport function ProjectsIndex() {\n  const [first, ...rest] = projects;\n  return (\n    <div className={`${COLUMN} flex flex-col gap-group pt-pad-xl pb-section`}>\n      <PageHead label={projectsPage.label} title={projectsPage.title} lead={projectsPage.lead} />\n      <div className=\"grid gap-tiles-lg lg:grid-cols-2\">\n        <Reveal className=\"h-full\">\n          <ProjectCard p={first} large />\n        </Reveal>\n        <ul className=\"grid gap-tiles-lg sm:grid-cols-2\">\n          {rest.map((p, i) => (\n            <li key={p.slug}>\n              <Reveal index={i % 2} className=\"h-full\">\n                <ProjectCard p={p} />\n              </Reveal>\n            </li>\n          ))}\n        </ul>\n      </div>\n      <p className={NOTE}>\n        {projectsPage.areaNote} {sampleNote}\n      </p>\n    </div>\n  );\n}\n\n/**\n * One project: its name over two columns. On the left, its picture and its story (the summary,\n * what the money buys as counts, and a line from the people who run it). On the right, a card\n * that stays in view below the header: how far it is funded as a ring and in pounds, the way to\n * give (which carries the project through to the donate page), and where it is up to. An unknown\n * slug renders the 404.\n */\nexport function ProjectPage({ slug }: { slug: string }) {\n  const { choose } = useGift();\n  const p = projects.find((x) => x.slug === slug);\n  if (!p) return <NotFound />;\n  return (\n    <div className={`${COLUMN} flex flex-col gap-pad-lg pt-pad-xl pb-section`}>\n      <BaseLink href=\"/projects\" className={`nf-rise inline-flex min-h-11 items-center self-start text-ui ${LINK}`}>\n        {projectsPage.back}\n      </BaseLink>\n      <PageHead label={`${p.area} · ${p.kind}`} title={p.name} />\n      <div className=\"grid gap-group lg:grid-cols-[minmax(0,8fr)_minmax(0,4fr)] lg:gap-group-lg\">\n        <div className=\"flex min-w-0 flex-col gap-group\">\n          <Picture slug={p.slug} className=\"nf-rise aspect-[16/10] rounded-surface [--i:2]\" />\n          <Reveal className=\"flex flex-col gap-pad-md\">\n            <p className=\"max-w-2xl text-ui-lg text-pretty text-text\">{p.summary}</p>\n            <h2 className=\"font-display text-display-2xl font-semibold tracking-display text-text\">{projectsPage.builds}</h2>\n            <dl className=\"grid grid-cols-2 gap-tiles-lg sm:grid-cols-3\">\n              {p.builds.map((b) => (\n                <div key={b.label} className=\"flex flex-col-reverse justify-end gap-1 border-t border-line pt-pad-base\">\n                  <dt className=\"text-ui-md text-text-secondary\">{b.label}</dt>\n                  <dd className=\"font-display text-display-5xl font-bold tracking-[-0.05em] text-text tabular-nums\">{b.count}</dd>\n                </div>\n              ))}\n            </dl>\n            <p className=\"max-w-2xl text-ui-md text-pretty text-text-secondary\">{p.story}</p>\n            <p className={NOTE}>\n              {projectsPage.areaNote} {sampleNote}\n            </p>\n          </Reveal>\n        </div>\n        <aside aria-label={projectsPage.progress} className=\"lg:sticky lg:top-[calc(var(--nf-header)+1.5rem)] lg:self-start\">\n          <div className=\"flex flex-col gap-pad-md rounded-surface border border-line-subtle bg-surface p-pad-md shadow-raised\">\n            <div className=\"flex items-center gap-pad-base\">\n              <Ring pct={fundedOf(p)} />\n              <p className=\"flex flex-col\">\n                <span className=\"font-display text-display-2xl font-semibold tracking-display text-text tabular-nums\">{formatMoney(p.raised)}</span>\n                <span className=\"text-ui text-text-secondary\">{projectsPage.of(formatMoney(p.target))}</span>\n              </p>\n            </div>\n            <Button variant=\"primary\" size=\"lg\" nativeButton={false} render={<BaseLink href=\"/donate\" onClick={() => choose({ project: p.slug })} />} className=\"h-12! w-full\">\n              {projectsPage.give(p.name)}\n            </Button>\n            <h2 className=\"text-ui-md font-semibold text-text\">{projectsPage.progress}</h2>\n            <ol className=\"flex flex-col\">\n              {p.steps.map((s) => (\n                <li key={s.label} className=\"grid grid-cols-[1.5rem_1fr_auto] items-center gap-in border-t border-line-subtle py-2.5\">\n                  <span aria-hidden className={`size-3 rounded-full ${s.done ? \"bg-(--nf-sea)\" : \"border-2 border-line-strong\"}`} />\n                  <span className=\"text-ui text-text\">{s.label}</span>\n                  <span className={`text-ui-sm ${s.done ? \"text-text-secondary\" : \"font-medium text-brand-text\"}`}>{s.done ? projectsPage.done : projectsPage.next}</span>\n                </li>\n              ))}\n            </ol>\n          </div>\n        </aside>\n      </div>\n    </div>\n  );\n}\n\n/** How far a project is funded, as a ring with the percentage in it. Drawn once, still. */\nfunction Ring({ pct }: { pct: number }) {\n  const r = 26;\n  const c = 2 * Math.PI * r;\n  return (\n    <span className=\"relative flex size-16 shrink-0 items-center justify-center\">\n      <svg viewBox=\"0 0 64 64\" className=\"absolute inset-0 -rotate-90\" aria-hidden>\n        <circle cx=\"32\" cy=\"32\" r={r} fill=\"none\" stroke=\"var(--eased-surface-active)\" strokeWidth=\"7\" />\n        <circle cx=\"32\" cy=\"32\" r={r} fill=\"none\" stroke=\"var(--nf-sea)\" strokeWidth=\"7\" strokeLinecap=\"round\" strokeDasharray={`${(c * pct) / 100} ${c}`} />\n      </svg>\n      <span className=\"relative text-ui-sm font-semibold text-text tabular-nums\">{pct}%</span>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/eased/templates/nonprofit/projects-page.tsx"
    }
  ],
  "meta": {
    "template": "nonprofit",
    "kind": "template-section",
    "industries": [
      "health"
    ]
  },
  "type": "registry:block"
}