Organizations block: the Partners page's cards, picked one by one or every one of a kind
Migration 093 adds the 'organizations' block type (rebuilding content_blocks for its CHECK, as 088 did), content_blocks.org_kind and content_block_items.org_id. OrgListCards takes `nested` for a block: no page gutter, names a level under the block's heading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e9ea75a68d
commit
bd271ef02d
8 changed files with 182 additions and 13 deletions
|
|
@ -19,6 +19,9 @@ import { useReadingMode } from '../../lib/readingMode.ts'
|
|||
|
||||
<OrgListCards kind="partner" pageLabel="Partner page" />
|
||||
<OrgListCards ids={["unity-worldwide", "unity-of-x"]} /> in that order
|
||||
<OrgListCards ids={...} nested /> inside a content block (093):
|
||||
no page gutter, names under
|
||||
the block's heading
|
||||
|
||||
Where the vertical list expands in place, a card links out. The
|
||||
card carries as much as fits at a glance and the organization's
|
||||
|
|
@ -123,11 +126,11 @@ function OrgCard({ org, accent, pageLabel, siteLabel, titled }) {
|
|||
);
|
||||
}
|
||||
|
||||
function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
||||
function Block({ title, orgs, accent, pageLabel, siteLabel, nested = false }) {
|
||||
if (orgs.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section className="mb-12">
|
||||
<section className={nested ? undefined : "mb-12"}>
|
||||
{title && (
|
||||
<h3 className="text-xl font-bold mb-5" style={{ color: FALLBACK_COLOR }}>
|
||||
{title}
|
||||
|
|
@ -147,7 +150,7 @@ function Block({ title, orgs, accent, pageLabel, siteLabel }) {
|
|||
accent={accent}
|
||||
pageLabel={pageLabel}
|
||||
siteLabel={siteLabel}
|
||||
titled={!!title}
|
||||
titled={!!title || nested}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
@ -167,14 +170,30 @@ export default function OrgListCards({
|
|||
siteLabel = "Visit site",
|
||||
sort = byName,
|
||||
empty = "Nothing to show here yet.",
|
||||
nested = false,
|
||||
}: {
|
||||
kind?: string | null;
|
||||
ids?: string[];
|
||||
title?: string;
|
||||
groups?: Array<{ key: string; title: string; pageLabel?: string; siteLabel?: string }>;
|
||||
groupBy?: (org: any) => unknown;
|
||||
accent?: string;
|
||||
pageLabel?: string;
|
||||
siteLabel?: string;
|
||||
sort?: ((a: any, b: any) => number) | null;
|
||||
empty?: string;
|
||||
nested?: boolean;
|
||||
}) {
|
||||
const { organizations, loading, error } = useOrganizations(kind, ids);
|
||||
|
||||
const shell = children => (
|
||||
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: GRID_MAX }}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
const shell = children =>
|
||||
nested ? (
|
||||
<div>{children}</div>
|
||||
) : (
|
||||
<div className="mx-auto px-8 md:px-12" style={{ maxWidth: GRID_MAX }}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
if (loading && organizations.length === 0) {
|
||||
return shell(
|
||||
|
|
@ -214,6 +233,7 @@ export default function OrgListCards({
|
|||
accent={accent}
|
||||
pageLabel={pageLabel}
|
||||
siteLabel={siteLabel}
|
||||
nested={nested}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue