@sarimarcus/content-sites-ui 0.42.3 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/editorial/ChronologyTimeline.astro +11 -5
- package/src/editorial/EraScenes.astro +34 -24
- package/src/editorial/EraTimelineNav.astro +47 -0
- package/src/editorial/PeopleHub.astro +111 -0
- package/src/editorial/PeopleTimeline.astro +69 -0
- package/src/editorial/index.ts +4 -0
- package/src/editorial/people-timeline.ts +71 -0
- package/src/internal/labels.ts +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.43.0 (2026-10-22)
|
|
6
|
+
|
|
7
|
+
### Breaking
|
|
8
|
+
|
|
9
|
+
- `EraScenes` no longer renders a heading and placeholder line for an empty People, Monuments or Articles strip: the strip is left out. An era with no entries at all collapses to a one-line marker (label and range) that keeps its `id` and `data-chronology-era`, so `eraHref()` links still resolve. The `emptyPeople`, `emptyMonuments` and `emptyArticles` keys are removed from `labels` (`LABELS.eraScenes`); no site passes them, so no codemod is needed. (SLA-3313)
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `editorial`: new `EraTimelineNav`, a sticky horizontal era rail (label over range, one equal-width segment per era) driven by the shared ToC scrollspy; shown at `md` and up, with the chip index kept below. `EraScenes` and `ChronologyTimeline` take `indexStyle="chips" | "timeline"` (default `chips`, output unchanged). The timeline raises the jump-target offsets (`scroll-mt-36`, `md:top-36`) to clear the rail. (SLA-3313)
|
|
14
|
+
|
|
15
|
+
## 0.42.4 (2026-10-22)
|
|
16
|
+
|
|
17
|
+
- `editorial`: new `PeopleHub`, the body of a people hub page (title band, era index, `PeopleTimeline`, one section per era with the era hook, intro and an optional per-era note, `PersonCard`s, and a "walk in their footsteps" block of era dossiers and people's articles), and `PeopleTimeline`, a static no-JS strip of equal-width era segments with one linked dot per person in birth order (hollow when undated, 44px hit areas, hidden below md). New `layoutPeopleTimeline()` and `footstepLinks()` helpers and `PeopleTimelineEntry` types; copy defaults in `LABELS.peopleTimeline` and `LABELS.peopleHub`. All prose is a prop. No change to existing components' markup (SLA-3310).
|
|
18
|
+
|
|
5
19
|
## 0.42.3 (2026-10-22)
|
|
6
20
|
|
|
7
21
|
- `editorial`: `ChronologyTimeline` and `EraScenes` share internal `EraEntryRow`, `EraDossiers` and `Thumb` pieces and the `orderEras`/`orphanEraIds` helpers of `chronology.ts`; `ChronologyTimeline` renders identically, and `EraScenes` differs only in the class order of its article thumbnail box (SLA-3307). `composed`: `CardCarousel` no longer ships a global `<style>`: its track hides the scrollbar with the existing `scrollbar-hide` utility and draws its focus ring with `focus-visible:` utilities, so the `cc-track` class is gone and no carousel CSS reaches a page that imports a barrel reaching it. The track's `class` attribute changes on every carousel; the rendering does not. `editorial`: the People strip of `EraScenes` is now a `CardCarousel` (arrows, dots, a named region) in place of a plain scroll-snap track; the `#<era>-people` anchor moves from the heading to the carousel's wrapper (SLA-3308).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "Universal Astro UI components, layout shell and design tokens shared by the content sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"@lucide/astro": "^1.23.0",
|
|
51
51
|
"astro": "^7.0.6",
|
|
52
52
|
"tailwindcss": "^4.1.18",
|
|
53
|
-
"@sarimarcus/content-sites-core": "0.
|
|
53
|
+
"@sarimarcus/content-sites-core": "0.43.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -7,6 +7,7 @@ import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
|
7
7
|
import TableOfContents from '../composed/TableOfContents.astro';
|
|
8
8
|
import EraDossiers from './EraDossiers.astro';
|
|
9
9
|
import EraEntryRow from './EraEntryRow.astro';
|
|
10
|
+
import EraTimelineNav from './EraTimelineNav.astro';
|
|
10
11
|
import { LABELS } from '../internal/labels';
|
|
11
12
|
import { orderEras, orphanEraIds, type TimelineItem } from './chronology';
|
|
12
13
|
|
|
@@ -17,6 +18,8 @@ interface Props {
|
|
|
17
18
|
emptyEra?: 'hide' | 'show';
|
|
18
19
|
/** The jump links above the rail, shown when two or more eras render in full. */
|
|
19
20
|
index?: boolean;
|
|
21
|
+
/** `timeline` swaps the chips for a horizontal rail at md+ (chips stay below). */
|
|
22
|
+
indexStyle?: 'chips' | 'timeline';
|
|
20
23
|
indexLabel?: string;
|
|
21
24
|
dossiersLabel?: string;
|
|
22
25
|
emptyLabel?: string;
|
|
@@ -30,6 +33,7 @@ const {
|
|
|
30
33
|
items,
|
|
31
34
|
emptyEra = 'hide',
|
|
32
35
|
index = true,
|
|
36
|
+
indexStyle = 'chips',
|
|
33
37
|
indexLabel = LABELS.chronologyTimeline.indexLabel,
|
|
34
38
|
dossiersLabel = LABELS.chronologyTimeline.dossiersLabel,
|
|
35
39
|
emptyLabel = LABELS.chronologyTimeline.emptyLabel,
|
|
@@ -46,6 +50,8 @@ const rows = orderEras(eras).map((era) => {
|
|
|
46
50
|
: [{ entries, label: '' }];
|
|
47
51
|
return { era, runs, full: entries.length > 0 || emptyEra === 'show' };
|
|
48
52
|
});
|
|
53
|
+
const smt = indexStyle === 'timeline' ? 'scroll-mt-36' : 'scroll-mt-28';
|
|
54
|
+
const stickyTop = indexStyle === 'timeline' ? 'md:top-36' : 'md:top-28';
|
|
49
55
|
const fullEras = rows.filter((r) => r.full).map((r) => r.era);
|
|
50
56
|
|
|
51
57
|
if (import.meta.env.DEV) {
|
|
@@ -55,9 +61,9 @@ if (import.meta.env.DEV) {
|
|
|
55
61
|
---
|
|
56
62
|
|
|
57
63
|
<div class:list={['w-full', className]} data-chronology>
|
|
58
|
-
{index && fullEras.length > 1 && (
|
|
64
|
+
{index && fullEras.length > 1 && indexStyle === 'timeline' && <EraTimelineNav eras={fullEras} ariaLabel={indexLabel} />}{index && fullEras.length > 1 && (
|
|
59
65
|
<TableOfContents
|
|
60
|
-
class=
|
|
66
|
+
class:list={['mb-12 md:mb-16', indexStyle === 'timeline' && 'md:hidden']}
|
|
61
67
|
showHeader={false}
|
|
62
68
|
ariaLabel={indexLabel}
|
|
63
69
|
items={fullEras.map((era) => ({ label: era.label, href: `#${era.anchor}` }))}
|
|
@@ -67,12 +73,12 @@ if (import.meta.env.DEV) {
|
|
|
67
73
|
)}
|
|
68
74
|
<ol class="grid">
|
|
69
75
|
{rows.map(({ era, runs, full }) => full ? (
|
|
70
|
-
<li class=
|
|
76
|
+
<li class={`${smt} group/era grid grid-cols-[1.25rem_minmax(0,1fr)] grid-rows-[auto_auto_1fr] gap-x-4 md:grid-cols-[10rem_1.25rem_minmax(0,1fr)] md:grid-rows-[auto_1fr] md:gap-x-6`} id={era.anchor} data-chronology-era={era.id}>
|
|
71
77
|
<div class="relative col-start-1 row-span-3 flex justify-center md:col-start-2 md:row-span-2 before:absolute before:inset-y-0 before:left-1/2 before:w-0.5 before:-translate-x-1/2 before:bg-foreground/15 group-first/era:before:top-3 md:group-first/era:before:top-4" aria-hidden="true">
|
|
72
78
|
<span class="relative mt-3 size-3 rotate-45 bg-primary ring-4 ring-background md:mt-4 md:size-3.5"></span>
|
|
73
79
|
</div>
|
|
74
80
|
<h2 class="col-start-2 row-start-1 font-display text-3xl leading-tight text-balance text-foreground md:col-start-3 md:text-4xl">{era.label}</h2>
|
|
75
|
-
<p class=
|
|
81
|
+
<p class={`col-start-2 row-start-2 mt-1 font-display text-lg tabular-nums text-secondary md:col-start-1 md:row-start-1 md:row-span-2 md:mt-4 md:self-start md:sticky ${stickyTop} md:text-right md:text-xl md:leading-snug`}>{era.rangeLabel}</p>
|
|
76
82
|
<div class="col-start-2 row-start-3 pb-16 md:col-start-3 md:row-start-2 md:pb-24 group-last/era:pb-0">
|
|
77
83
|
<p class="mt-4 max-w-measure text-lg leading-relaxed text-foreground">{era.intro}</p>
|
|
78
84
|
{runs.map((run) => run.entries.length > 0 && (
|
|
@@ -87,7 +93,7 @@ if (import.meta.env.DEV) {
|
|
|
87
93
|
</div>
|
|
88
94
|
</li>
|
|
89
95
|
) : (
|
|
90
|
-
<li class=
|
|
96
|
+
<li class={`${smt} group/era grid grid-cols-[1.25rem_minmax(0,1fr)] gap-x-4 md:grid-cols-[10rem_1.25rem_minmax(0,1fr)] md:gap-x-6`} id={era.anchor} data-chronology-era={era.id} data-chronology-empty>
|
|
91
97
|
<div class="relative col-start-1 flex justify-center md:col-start-2 before:absolute before:inset-y-0 before:left-1/2 before:w-0.5 before:-translate-x-1/2 before:bg-foreground/15 group-first/era:before:top-2" aria-hidden="true">
|
|
92
98
|
<span class="relative mt-2 size-2 rotate-45 border border-muted-foreground bg-background"></span>
|
|
93
99
|
</div>
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* EraScenes — a site's eras as stacked scenes, one per era: hero (image, date range, title, hook), a cast row of
|
|
4
4
|
* faces and buildings that anchors to the strips below, the era's intro, then people, monuments and articles.
|
|
5
5
|
* Entries arrive in `items` keyed by era id, each tagged with its strip (`SceneItem.type`); `splitScene` picks the
|
|
6
|
-
* cast and caps the articles. An empty
|
|
7
|
-
*
|
|
6
|
+
* cast and caps the articles. An empty strip is left out; an era with no entries at all collapses to a one-line
|
|
7
|
+
* marker that keeps `id={era.anchor}`, so eraHref() links never dead-end. Without `era.image` the header is a
|
|
8
8
|
* plain bordered panel. Scenes alternate a muted tint. Only the first scene's hero loads eagerly.
|
|
9
|
-
* The `index`
|
|
9
|
+
* The `index` jumps between eras, as chips or (`indexStyle="timeline"`, md+) a sticky horizontal rail;
|
|
10
|
+
* `data-chronology-era` marks each scene for its scrollspy.
|
|
10
11
|
*/
|
|
11
12
|
import type { ImageMetadata } from 'astro';
|
|
12
13
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
@@ -20,6 +21,7 @@ import PersonCard from './PersonCard.astro';
|
|
|
20
21
|
import CardPlaceholder from './CardPlaceholder.astro';
|
|
21
22
|
import EraDossiers from './EraDossiers.astro';
|
|
22
23
|
import EraEntryRow from './EraEntryRow.astro';
|
|
24
|
+
import EraTimelineNav from './EraTimelineNav.astro';
|
|
23
25
|
import Thumb from './Thumb.astro';
|
|
24
26
|
import { LABELS } from '../internal/labels';
|
|
25
27
|
import { orderEras, orphanEraIds, splitScene, type SceneItem } from './chronology';
|
|
@@ -32,13 +34,15 @@ interface Props {
|
|
|
32
34
|
items: Record<string, readonly SceneItem[]>;
|
|
33
35
|
/** The jump links above the scenes. */
|
|
34
36
|
index?: boolean;
|
|
37
|
+
/** `timeline` swaps the chips for a horizontal rail at md+ (chips stay below). */
|
|
38
|
+
indexStyle?: 'chips' | 'timeline';
|
|
35
39
|
castLimit?: number;
|
|
36
40
|
articleLimit?: number;
|
|
37
41
|
labels?: Partial<SceneLabels>;
|
|
38
42
|
class?: string;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
const { eras, items, index = true, castLimit = 6, articleLimit = 5, labels, class: className } = Astro.props;
|
|
45
|
+
const { eras, items, index = true, indexStyle = 'chips', castLimit = 6, articleLimit = 5, labels, class: className } = Astro.props;
|
|
42
46
|
const L: SceneLabels = { ...LABELS.eraScenes, ...labels };
|
|
43
47
|
|
|
44
48
|
const scenes = orderEras(eras).map((era) => ({ era, scene: splitScene(items[era.id] ?? [], { castLimit, articleLimit }) }));
|
|
@@ -51,12 +55,14 @@ if (import.meta.env.DEV) {
|
|
|
51
55
|
const asImage = (image: SceneItem['image']): ImageMetadata | undefined => (typeof image === 'object' ? image : undefined);
|
|
52
56
|
const asSrc = (image: SceneItem['image']): string | undefined => (typeof image === 'string' ? image : undefined);
|
|
53
57
|
const cardWidth = 'snap-start shrink-0 w-[72vw] sm:w-60';
|
|
58
|
+
// The timeline rail is taller than the header gap, so jump targets stop lower under it.
|
|
59
|
+
const scrollMt = indexStyle === 'timeline' ? 'scroll-mt-36' : 'scroll-mt-28';
|
|
54
60
|
const stripHeading = 'font-display text-2xl text-foreground';
|
|
55
61
|
---
|
|
56
62
|
|
|
57
63
|
<div data-era-scenes class:list={['w-full', className]}>
|
|
58
|
-
{index && scenes.length > 1 && (
|
|
59
|
-
<Container class=
|
|
64
|
+
{index && scenes.length > 1 && indexStyle === 'timeline' && <EraTimelineNav eras={scenes.map((s) => s.era)} ariaLabel={L.indexLabel} />}{index && scenes.length > 1 && (
|
|
65
|
+
<Container class:list={['pb-8 md:pb-12', indexStyle === 'timeline' && 'md:hidden']}>
|
|
60
66
|
<TableOfContents
|
|
61
67
|
showHeader={false}
|
|
62
68
|
ariaLabel={L.indexLabel}
|
|
@@ -72,12 +78,25 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
72
78
|
return { item, href: `#${era.anchor}-${item.type}-${list.indexOf(item)}` };
|
|
73
79
|
});
|
|
74
80
|
const hero = era.image;
|
|
81
|
+
if (scene.people.length + scene.monuments.length + scene.articles.length === 0) {
|
|
82
|
+
return (
|
|
83
|
+
<section id={era.anchor} data-chronology-era={era.id} data-era-empty aria-label={era.label} class:list={[scrollMt, 'py-4']}>
|
|
84
|
+
<Container>
|
|
85
|
+
<p class="flex flex-wrap items-baseline gap-x-2 text-sm text-muted-foreground">
|
|
86
|
+
<span class="font-display text-base text-foreground">{era.label}</span>
|
|
87
|
+
<span aria-hidden="true">·</span>
|
|
88
|
+
<span class="tabular-nums">{era.rangeLabel}</span>
|
|
89
|
+
</p>
|
|
90
|
+
</Container>
|
|
91
|
+
</section>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
75
94
|
return (
|
|
76
95
|
<section
|
|
77
96
|
id={era.anchor}
|
|
78
97
|
data-chronology-era={era.id}
|
|
79
98
|
aria-labelledby={`${era.anchor}-title`}
|
|
80
|
-
class:list={['
|
|
99
|
+
class:list={[scrollMt, 'py-10 md:py-14', n % 2 === 1 && 'bg-muted/30']}
|
|
81
100
|
>
|
|
82
101
|
<Container>
|
|
83
102
|
<header class:list={['relative isolate flex min-h-60 items-end overflow-hidden rounded-xl sm:min-h-72 md:min-h-80', !hero && 'border border-border bg-card']}>
|
|
@@ -123,11 +142,11 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
123
142
|
|
|
124
143
|
<p class="mt-8 max-w-measure text-lg leading-relaxed text-foreground">{era.intro}</p>
|
|
125
144
|
|
|
145
|
+
{scene.people.length > 0 && (
|
|
126
146
|
<div class="mt-10">
|
|
127
|
-
{scene.people.length > 0 ? (
|
|
128
147
|
<CardCarousel id={`${era.anchor}-people`} heading={L.peopleHeading} headingTag="h3" headingClass={stripHeading} ariaLabel={`${era.label}: ${L.peopleHeading}`}>
|
|
129
148
|
{scene.people.map((item, i) => (
|
|
130
|
-
<div id={`${era.anchor}-person-${i}`} class={`${cardWidth}
|
|
149
|
+
<div id={`${era.anchor}-person-${i}`} class={`${cardWidth} ${scrollMt}`}>
|
|
131
150
|
<PersonCard
|
|
132
151
|
href={item.href}
|
|
133
152
|
name={item.title}
|
|
@@ -143,20 +162,15 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
143
162
|
</div>
|
|
144
163
|
))}
|
|
145
164
|
</CardCarousel>
|
|
146
|
-
) : (
|
|
147
|
-
<>
|
|
148
|
-
<h3 id={`${era.anchor}-people`} class={stripHeading}>{L.peopleHeading}</h3>
|
|
149
|
-
<p class="mt-2 text-muted-foreground">{L.emptyPeople}</p>
|
|
150
|
-
</>
|
|
151
|
-
)}
|
|
152
165
|
</div>
|
|
166
|
+
)}
|
|
153
167
|
|
|
168
|
+
{scene.monuments.length > 0 && (
|
|
154
169
|
<div class="mt-10">
|
|
155
170
|
<h3 id={`${era.anchor}-monuments`} class={stripHeading}>{L.monumentsHeading}</h3>
|
|
156
|
-
{scene.monuments.length > 0 ? (
|
|
157
171
|
<div class="mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
|
158
172
|
{scene.monuments.map((item, i) => (
|
|
159
|
-
<div id={`${era.anchor}-monument-${i}`} class=
|
|
173
|
+
<div id={`${era.anchor}-monument-${i}`} class={scrollMt}>
|
|
160
174
|
<EntityCard
|
|
161
175
|
href={item.href}
|
|
162
176
|
variant="poster"
|
|
@@ -181,21 +195,17 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
181
195
|
</div>
|
|
182
196
|
))}
|
|
183
197
|
</div>
|
|
184
|
-
) : (
|
|
185
|
-
<p class="mt-2 text-muted-foreground">{L.emptyMonuments}</p>
|
|
186
|
-
)}
|
|
187
198
|
</div>
|
|
199
|
+
)}
|
|
188
200
|
|
|
201
|
+
{scene.articles.length > 0 && (
|
|
189
202
|
<div class="mt-10">
|
|
190
203
|
<h3 id={`${era.anchor}-articles`} class={stripHeading}>{L.articlesHeading}</h3>
|
|
191
|
-
{scene.articles.length > 0 ? (
|
|
192
204
|
<ol aria-labelledby={`${era.anchor}-articles`} class="mt-4 divide-y divide-border border-y border-border">
|
|
193
205
|
{scene.articles.map((item) => <EraEntryRow item={item} headingLevel={4} />)}
|
|
194
206
|
</ol>
|
|
195
|
-
) : (
|
|
196
|
-
<p class="mt-2 text-muted-foreground">{L.emptyArticles}</p>
|
|
197
|
-
)}
|
|
198
207
|
</div>
|
|
208
|
+
)}
|
|
199
209
|
|
|
200
210
|
<EraDossiers era={era} label={L.dossiersLabel} />
|
|
201
211
|
</Container>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* EraTimelineNav — the era index as a horizontal rail: equal-width segments (label over range) joined by a line, the
|
|
4
|
+
* era in view marked by the shared ToC scrollspy (`data-toc`, `data-section-link`). Sticky under the header, hidden
|
|
5
|
+
* below md where the chip index takes over. Segments link to `#<era.anchor>`; `sectionSelector` marks the era sections.
|
|
6
|
+
* Ships no script: the chip `TableOfContents` rendered beside it loads the controller (a second script entry splits
|
|
7
|
+
* toc.ts into a shared chunk and the controller stops inlining).
|
|
8
|
+
*/
|
|
9
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
10
|
+
import { LABELS } from '../internal/labels';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
eras: readonly EraDefinition[];
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
sectionSelector?: string;
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { eras, ariaLabel = LABELS.eraTimelineNav.ariaLabel, sectionSelector = '[data-chronology-era]', class: className } = Astro.props;
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
{eras.length > 1 && (
|
|
23
|
+
<nav
|
|
24
|
+
data-toc
|
|
25
|
+
data-era-timeline-nav
|
|
26
|
+
data-toc-section-selector={sectionSelector}
|
|
27
|
+
aria-label={ariaLabel}
|
|
28
|
+
class:list={['sticky top-16 z-30 hidden border-b border-border bg-background/95 backdrop-blur-sm md:block', className]}
|
|
29
|
+
>
|
|
30
|
+
<ol class="mx-auto flex max-w-shell px-4 sm:px-6 lg:px-8">
|
|
31
|
+
{eras.map((era) => (
|
|
32
|
+
<li class="min-w-0 flex-1">
|
|
33
|
+
<a
|
|
34
|
+
href={`#${era.anchor}`}
|
|
35
|
+
data-section-link={era.anchor}
|
|
36
|
+
class="group relative block px-2 pb-3 pt-4 text-center focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
|
|
37
|
+
>
|
|
38
|
+
<span class="absolute inset-x-0 top-0 h-0.5 bg-border group-data-[active=true]:bg-primary" aria-hidden="true"></span>
|
|
39
|
+
<span class="absolute left-1/2 top-0 size-2.5 -translate-x-1/2 -translate-y-1/2 rotate-45 border border-border bg-background group-data-[active=true]:border-primary group-data-[active=true]:bg-primary" aria-hidden="true"></span>
|
|
40
|
+
<span class="block truncate font-display text-base leading-tight text-foreground group-hover:text-primary group-data-[active=true]:text-primary">{era.label}</span>
|
|
41
|
+
<span class="mt-0.5 block truncate text-xs tabular-nums text-muted-foreground">{era.rangeLabel}</span>
|
|
42
|
+
</a>
|
|
43
|
+
</li>
|
|
44
|
+
))}
|
|
45
|
+
</ol>
|
|
46
|
+
</nav>
|
|
47
|
+
)}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* PeopleHub — the body of a people hub page: title band, era index, people timeline, then one section per era
|
|
4
|
+
* (era hook and intro, an optional people-focused line, PersonCards) and a closing "walk in their footsteps" block
|
|
5
|
+
* built from the eras' dossiers and each person's article. Prose arrives as props: nothing is written here.
|
|
6
|
+
* The site keeps Layout, StructuredData and the breadcrumb band, and wraps this in `<main>`.
|
|
7
|
+
*/
|
|
8
|
+
import type { ImageMetadata } from 'astro';
|
|
9
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
10
|
+
import TableOfContents from '../composed/TableOfContents.astro';
|
|
11
|
+
import Container from '../layout/Container.astro';
|
|
12
|
+
import LinkArrow from '../primitives/LinkArrow.astro';
|
|
13
|
+
import PersonCard from './PersonCard.astro';
|
|
14
|
+
import PeopleTimeline from './PeopleTimeline.astro';
|
|
15
|
+
import { LABELS } from '../internal/labels';
|
|
16
|
+
import { footstepLinks, layoutPeopleTimeline, type PeopleTimelineEntry } from './people-timeline';
|
|
17
|
+
|
|
18
|
+
interface HubPerson extends PeopleTimelineEntry {
|
|
19
|
+
image?: ImageMetadata;
|
|
20
|
+
imageAlt: string;
|
|
21
|
+
roles?: readonly string[];
|
|
22
|
+
knownFor?: string;
|
|
23
|
+
/** The person's main article, listed in the footsteps block. */
|
|
24
|
+
article?: { label: string; href: string };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
title: string;
|
|
29
|
+
/** Under the title, 1-2 short lines. */
|
|
30
|
+
lede?: string;
|
|
31
|
+
/** Hub intro paragraphs, shown under the lede band. */
|
|
32
|
+
intro?: readonly string[];
|
|
33
|
+
eras: readonly EraDefinition[];
|
|
34
|
+
people: readonly HubPerson[];
|
|
35
|
+
/** People-focused line per era id, shown after the era intro. */
|
|
36
|
+
eraNotes?: Record<string, string>;
|
|
37
|
+
indexLabel?: string;
|
|
38
|
+
timelineLabel?: string;
|
|
39
|
+
footstepsHeading?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
title,
|
|
44
|
+
lede,
|
|
45
|
+
intro = [],
|
|
46
|
+
eras,
|
|
47
|
+
people,
|
|
48
|
+
eraNotes = {},
|
|
49
|
+
indexLabel = LABELS.peopleHub.indexLabel,
|
|
50
|
+
timelineLabel,
|
|
51
|
+
footstepsHeading = LABELS.peopleHub.footstepsHeading,
|
|
52
|
+
} = Astro.props;
|
|
53
|
+
|
|
54
|
+
const segments = layoutPeopleTimeline(eras, people);
|
|
55
|
+
const sections = segments.map(({ era, dots }) => ({ era, group: dots }));
|
|
56
|
+
const footsteps = footstepLinks(segments.map((s) => s.era), segments.flatMap((s) => s.dots));
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
<div class="bg-muted/30 border-b border-border pt-12 pb-10" data-pagefind-body>
|
|
60
|
+
<Container>
|
|
61
|
+
<h1 class="max-w-measure text-3xl sm:text-4xl font-normal font-display text-foreground leading-tight text-balance">{title}</h1>
|
|
62
|
+
{lede && <p class="mt-5 max-w-measure text-lg text-muted-foreground leading-relaxed">{lede}</p>}
|
|
63
|
+
{intro.map((paragraph) => <p class="mt-4 max-w-measure text-base text-foreground leading-relaxed">{paragraph}</p>)}
|
|
64
|
+
</Container>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="py-12 lg:py-20" data-pagefind-body>
|
|
68
|
+
<Container>
|
|
69
|
+
<TableOfContents
|
|
70
|
+
class="mb-8 md:hidden"
|
|
71
|
+
showHeader={false}
|
|
72
|
+
ariaLabel={indexLabel}
|
|
73
|
+
items={sections.map(({ era, group }) => ({ label: `${era.label} (${group.length})`, href: `#era-${era.id}` }))}
|
|
74
|
+
sectionSelector="[data-people-era]"
|
|
75
|
+
hideMiniPastLastSection
|
|
76
|
+
/>
|
|
77
|
+
<PeopleTimeline class="mb-14" segments={segments} ariaLabel={timelineLabel} />
|
|
78
|
+
{sections.map(({ era, group }) => (
|
|
79
|
+
<section id={`era-${era.id}`} class="mb-14 scroll-mt-28" aria-labelledby={`era-${era.id}-heading`} data-people-era>
|
|
80
|
+
<h2 id={`era-${era.id}-heading`} class="font-display text-2xl font-semibold text-foreground">{era.label}</h2>
|
|
81
|
+
{era.hook && <p class="mt-2 max-w-measure font-display text-lg text-secondary">{era.hook}</p>}
|
|
82
|
+
<p class="mt-3 max-w-measure text-base text-foreground leading-relaxed">{era.intro}</p>
|
|
83
|
+
{eraNotes[era.id] && <p class="mt-3 max-w-measure text-base text-foreground leading-relaxed">{eraNotes[era.id]}</p>}
|
|
84
|
+
<div class="mt-6 grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
85
|
+
{group.map((p) => (
|
|
86
|
+
<PersonCard
|
|
87
|
+
href={p.href}
|
|
88
|
+
name={p.name}
|
|
89
|
+
image={p.image}
|
|
90
|
+
imageAlt={p.imageAlt}
|
|
91
|
+
dates={p.dates}
|
|
92
|
+
roles={p.roles}
|
|
93
|
+
knownFor={p.knownFor}
|
|
94
|
+
eraLabel={`${era.label} · ${era.rangeLabel}`}
|
|
95
|
+
/>
|
|
96
|
+
))}
|
|
97
|
+
</div>
|
|
98
|
+
</section>
|
|
99
|
+
))}
|
|
100
|
+
{footsteps.length > 0 && (
|
|
101
|
+
<section class="border-t border-border pt-10" aria-labelledby="people-footsteps-heading">
|
|
102
|
+
<h2 id="people-footsteps-heading" class="font-display text-2xl font-semibold text-foreground">{footstepsHeading}</h2>
|
|
103
|
+
<ul class="mt-4 grid gap-x-8 sm:grid-cols-2">
|
|
104
|
+
{footsteps.map((link) => (
|
|
105
|
+
<li><LinkArrow href={link.href} color="secondary" class="min-h-11">{link.label}</LinkArrow></li>
|
|
106
|
+
))}
|
|
107
|
+
</ul>
|
|
108
|
+
</section>
|
|
109
|
+
)}
|
|
110
|
+
</Container>
|
|
111
|
+
</div>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* PeopleTimeline — a static, no-JS strip of the eras that have people: equal-width era segments, one dot per person
|
|
4
|
+
* in birth order, each linking to its target. People with no dates come last in their era as a hollow dot. Era labels
|
|
5
|
+
* link to `#<sectionIdPrefix><era.id>`. Hidden below md: the hub's era index takes over there.
|
|
6
|
+
*/
|
|
7
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
8
|
+
import { LABELS } from '../internal/labels';
|
|
9
|
+
import { layoutPeopleTimeline, type PeopleTimelineEntry, type PeopleTimelineSegment } from './people-timeline';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
/** With `people`, laid out here; or pass `segments` already laid out (PeopleHub does, to group once). */
|
|
13
|
+
eras?: readonly EraDefinition[];
|
|
14
|
+
people?: readonly PeopleTimelineEntry[];
|
|
15
|
+
segments?: readonly PeopleTimelineSegment[];
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
/** Fragment prefix of the era sections the labels link to. */
|
|
18
|
+
sectionIdPrefix?: string;
|
|
19
|
+
approximateLabel?: string;
|
|
20
|
+
class?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
eras = [],
|
|
25
|
+
people = [],
|
|
26
|
+
segments: laidOut,
|
|
27
|
+
ariaLabel = LABELS.peopleTimeline.ariaLabel,
|
|
28
|
+
sectionIdPrefix = 'era-',
|
|
29
|
+
approximateLabel = LABELS.peopleTimeline.approximate,
|
|
30
|
+
class: className,
|
|
31
|
+
} = Astro.props;
|
|
32
|
+
|
|
33
|
+
const segments = laidOut ?? layoutPeopleTimeline(eras, people);
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
{segments.length > 0 && (
|
|
37
|
+
<nav aria-label={ariaLabel} class:list={['hidden md:block', className]} data-people-timeline>
|
|
38
|
+
<ol class="flex">
|
|
39
|
+
{segments.map(({ era, dots }) => (
|
|
40
|
+
<li class="min-w-0 flex-1 border-l border-border first:border-l-0">
|
|
41
|
+
<a href={`#${sectionIdPrefix}${era.id}`} class="flex min-h-11 flex-col justify-center px-2 text-center hover:text-primary focus-visible:text-primary">
|
|
42
|
+
<span class="block truncate font-display text-sm text-foreground">{era.label}</span>
|
|
43
|
+
<span class="block truncate text-xs tabular-nums text-muted-foreground">{era.rangeLabel}</span>
|
|
44
|
+
</a>
|
|
45
|
+
<div class="relative mx-2 mt-3 h-6">
|
|
46
|
+
<span class="absolute inset-x-0 top-1/2 h-0.5 -translate-y-1/2 bg-foreground/15" aria-hidden="true"></span>
|
|
47
|
+
{dots.map((dot) => {
|
|
48
|
+
const label = LABELS.peopleTimeline.dotLabel(dot.name, dot.dates);
|
|
49
|
+
const full = dot.approximate ? `${label} (${approximateLabel})` : label;
|
|
50
|
+
return (
|
|
51
|
+
<a
|
|
52
|
+
href={dot.href}
|
|
53
|
+
aria-label={full}
|
|
54
|
+
title={full}
|
|
55
|
+
style={`left:${dot.offset}%`}
|
|
56
|
+
class:list={[
|
|
57
|
+
'absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 ring-background before:absolute before:-inset-4 hover:scale-125 focus-visible:scale-125',
|
|
58
|
+
dot.approximate ? 'border border-primary bg-background' : 'bg-primary',
|
|
59
|
+
]}
|
|
60
|
+
data-approximate={dot.approximate ? '' : undefined}
|
|
61
|
+
></a>
|
|
62
|
+
);
|
|
63
|
+
})}
|
|
64
|
+
</div>
|
|
65
|
+
</li>
|
|
66
|
+
))}
|
|
67
|
+
</ol>
|
|
68
|
+
</nav>
|
|
69
|
+
)}
|
package/src/editorial/index.ts
CHANGED
|
@@ -32,6 +32,10 @@ export { default as AlsoExplore } from './AlsoExplore.astro';
|
|
|
32
32
|
export { default as VisitTiming } from './VisitTiming.astro';
|
|
33
33
|
export { default as ChronologyTimeline } from './ChronologyTimeline.astro';
|
|
34
34
|
export { groupByEra, type TimelineItem } from './chronology';
|
|
35
|
+
export { default as PeopleHub } from './PeopleHub.astro';
|
|
36
|
+
export { default as EraTimelineNav } from './EraTimelineNav.astro';
|
|
37
|
+
export { default as PeopleTimeline } from './PeopleTimeline.astro';
|
|
38
|
+
export { layoutPeopleTimeline, footstepLinks, type PeopleTimelineEntry, type PeopleTimelineDot, type PeopleTimelineSegment } from './people-timeline';
|
|
35
39
|
export { monogram } from './monogram';
|
|
36
40
|
export type { AlsoExploreItem } from './AlsoExplore.astro';
|
|
37
41
|
export type { VisitTimingData } from './VisitTiming.astro';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
2
|
+
import { groupByEra, orderEras } from './chronology.ts';
|
|
3
|
+
|
|
4
|
+
export interface PeopleTimelineEntry {
|
|
5
|
+
slug: string;
|
|
6
|
+
name: string;
|
|
7
|
+
href: string;
|
|
8
|
+
era?: string;
|
|
9
|
+
birthYear?: number;
|
|
10
|
+
deathYear?: number;
|
|
11
|
+
/** Life dates as displayed, shown in the dot's label. */
|
|
12
|
+
dates?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type PeopleTimelineDot<T extends PeopleTimelineEntry = PeopleTimelineEntry> = T & {
|
|
16
|
+
/** 0–100, position inside the era segment. */
|
|
17
|
+
offset: number;
|
|
18
|
+
/** No birth or death year: drawn hollow, in the slot its sort order gives it (last). */
|
|
19
|
+
approximate: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface PeopleTimelineSegment<T extends PeopleTimelineEntry = PeopleTimelineEntry> {
|
|
23
|
+
era: EraDefinition;
|
|
24
|
+
dots: PeopleTimelineDot<T>[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The closing "footsteps" links: each era's dossiers (oldest era first), then each person's article, both deduped by
|
|
29
|
+
* href. Eras without people are the caller's to leave out.
|
|
30
|
+
*/
|
|
31
|
+
export function footstepLinks(
|
|
32
|
+
eras: readonly EraDefinition[],
|
|
33
|
+
people: readonly { article?: { label: string; href: string } }[],
|
|
34
|
+
): { label: string; href: string }[] {
|
|
35
|
+
const seen = new Set<string>();
|
|
36
|
+
const links: { label: string; href: string }[] = [];
|
|
37
|
+
const add = (link: { label: string; href: string } | undefined) => {
|
|
38
|
+
if (!link || seen.has(link.href)) return;
|
|
39
|
+
seen.add(link.href);
|
|
40
|
+
links.push(link);
|
|
41
|
+
};
|
|
42
|
+
for (const era of orderEras(eras)) era.dossiers?.forEach(add);
|
|
43
|
+
people.forEach((p) => add(p.article));
|
|
44
|
+
return links;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* One segment per era that has people, oldest era first, equal widths. Inside a segment the dots follow birth year
|
|
49
|
+
* (death year when there is no birth year; people with neither come last, flagged approximate), in the order
|
|
50
|
+
* `groupByEra` gives and evenly spaced, so no two dots share a position. Entries with an unknown or missing era are
|
|
51
|
+
* dropped. The input is not mutated; each dot keeps every field of its entry.
|
|
52
|
+
*/
|
|
53
|
+
export function layoutPeopleTimeline<T extends PeopleTimelineEntry>(
|
|
54
|
+
eras: readonly EraDefinition[],
|
|
55
|
+
people: readonly T[],
|
|
56
|
+
): PeopleTimelineSegment<T>[] {
|
|
57
|
+
const groups = groupByEra(people, (p) => p.era, (p) => p.birthYear ?? p.deathYear, (p) => p.name);
|
|
58
|
+
return orderEras(eras)
|
|
59
|
+
.filter((era) => groups[era.id]?.length)
|
|
60
|
+
.map((era) => {
|
|
61
|
+
const group = groups[era.id];
|
|
62
|
+
return {
|
|
63
|
+
era,
|
|
64
|
+
dots: group.map((p, i) => ({
|
|
65
|
+
...p,
|
|
66
|
+
offset: ((i + 0.5) / group.length) * 100,
|
|
67
|
+
approximate: p.birthYear === undefined && p.deathYear === undefined,
|
|
68
|
+
})),
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}
|
package/src/internal/labels.ts
CHANGED
|
@@ -78,6 +78,15 @@ export const LABELS = {
|
|
|
78
78
|
eraChip: { ariaLabel: (label: string, range: string) => `${label}, ${range}: see this era on the chronology` },
|
|
79
79
|
personChip: { ariaLabel: (name: string, dates?: string) => `${name}${dates ? `, ${dates}` : ''}: read their profile` },
|
|
80
80
|
personCard: { cta: 'Read the profile' },
|
|
81
|
+
peopleTimeline: {
|
|
82
|
+
ariaLabel: 'People by era',
|
|
83
|
+
approximate: 'date unknown, placed mid-era',
|
|
84
|
+
dotLabel: (name: string, dates?: string) => (dates ? `${name}, ${dates}` : name),
|
|
85
|
+
},
|
|
86
|
+
peopleHub: {
|
|
87
|
+
indexLabel: 'Jump to an era',
|
|
88
|
+
footstepsHeading: 'Walk in their footsteps',
|
|
89
|
+
},
|
|
81
90
|
personPage: {
|
|
82
91
|
readFullStory: 'Read the full story',
|
|
83
92
|
fullStoryHeading: 'The full story',
|
|
@@ -123,15 +132,13 @@ export const LABELS = {
|
|
|
123
132
|
emptyLabel: '',
|
|
124
133
|
undatedLabel: 'Undated',
|
|
125
134
|
},
|
|
135
|
+
eraTimelineNav: { ariaLabel: 'Eras' },
|
|
126
136
|
eraScenes: {
|
|
127
137
|
...eraLabels,
|
|
128
138
|
castLabel: 'In this era',
|
|
129
139
|
peopleHeading: 'People',
|
|
130
140
|
monumentsHeading: 'Monuments',
|
|
131
141
|
articlesHeading: 'Articles',
|
|
132
|
-
emptyPeople: 'No people catalogued for this era yet.',
|
|
133
|
-
emptyMonuments: 'No monuments catalogued for this era yet.',
|
|
134
|
-
emptyArticles: 'No articles for this era yet.',
|
|
135
142
|
portraitAlt: (name: string) => `Portrait of ${name}`,
|
|
136
143
|
},
|
|
137
144
|
};
|