@sarimarcus/content-sites-ui 0.42.1 → 0.42.3
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 +8 -0
- package/package.json +2 -2
- package/src/composed/CardCarousel.astro +5 -18
- package/src/composed/index.ts +0 -1
- package/src/editorial/ChronologyTimeline.astro +7 -45
- package/src/editorial/EraDossiers.astro +24 -0
- package/src/editorial/EraEntryRow.astro +34 -0
- package/src/editorial/EraScenes.astro +205 -0
- package/src/editorial/PersonCard.astro +2 -2
- package/src/editorial/PersonPage.astro +2 -2
- package/src/editorial/Thumb.astro +22 -0
- package/src/editorial/chronology.ts +55 -0
- package/src/editorial/index.ts +3 -0
- package/src/internal/labels.ts +15 -2
- package/src/styles/tailwind.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.42.3 (2026-10-22)
|
|
6
|
+
|
|
7
|
+
- `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).
|
|
8
|
+
|
|
9
|
+
## 0.42.2 (2026-10-21)
|
|
10
|
+
|
|
11
|
+
- `editorial`: new `EraScenes`, a site's eras as stacked scenes: a hero (image, date range, title and hook; a bordered panel without an era image), a cast row of up to six imaged people and monuments that anchors to the strips, the era intro, then a People strip (`PersonCard`, role labels, life dates), a Monuments grid (4:3 `EntityCard`, a landmark placeholder without an image) and an Articles list capped at `articleLimit` (default 5). An empty strip keeps its heading and says so; the era index is a `TableOfContents`. New `SceneItem`, `SceneKind`, `EraScene` types and `splitScene()` (cast ranked imaged first, featured, then year); copy defaults in `LABELS.eraScenes`. `PersonCard`'s `headingLevel` also accepts 4. The People strip is a plain scroll-snap track, not `CardCarousel`, so its global CSS does not ship to every page that imports the editorial barrel. `ChronologyTimeline` and `PersonPage` markup are unchanged (SLA-3299).
|
|
12
|
+
|
|
5
13
|
## 0.42.1 (2026-10-21)
|
|
6
14
|
|
|
7
15
|
- `composed`: `EntityCard` gains `footerDivider` (default `true`, the hairline above the footer row); every existing caller renders identically. `editorial`: `PersonCard` and the featured full-story card of `PersonPage` pass `false`, so the divider above the CTA is gone on person cards (SLA-3303).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.3",
|
|
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.42.
|
|
53
|
+
"@sarimarcus/content-sites-core": "0.42.3"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -62,6 +62,10 @@ const trackId = `${containerId}-t`;
|
|
|
62
62
|
// The ::before grows the 36px circle into a 44px touch target.
|
|
63
63
|
const arrowClass =
|
|
64
64
|
'relative flex h-9 w-9 cursor-pointer items-center justify-center rounded-full border border-border bg-card transition-colors before:absolute before:-inset-1 hover:border-primary/40 hover:bg-primary/10 aria-disabled:pointer-events-none aria-disabled:opacity-25';
|
|
65
|
+
// Utilities, not component CSS: a style block here would ship to every page importing a barrel that reaches this file.
|
|
66
|
+
// The track stays swipable with no scrollbar; it is a keyboard focus stop, so it draws its own ring.
|
|
67
|
+
const trackClass =
|
|
68
|
+
'-mx-4 flex gap-4 overflow-x-auto scroll-px-4 px-4 py-1.5 snap-x snap-mandatory sm:mx-0 sm:scroll-px-0 sm:px-0 scrollbar-hide focus-visible:rounded-lg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary';
|
|
65
69
|
---
|
|
66
70
|
|
|
67
71
|
<div id={id} data-carousel={containerId} class:list={['scroll-mt-28', className]}>
|
|
@@ -110,7 +114,7 @@ const arrowClass =
|
|
|
110
114
|
<div
|
|
111
115
|
id={trackId}
|
|
112
116
|
data-carousel-track
|
|
113
|
-
class=
|
|
117
|
+
class={trackClass}
|
|
114
118
|
aria-label={ariaLabel ?? heading ?? regionLabel}
|
|
115
119
|
role="group"
|
|
116
120
|
tabindex="0"
|
|
@@ -120,23 +124,6 @@ const arrowClass =
|
|
|
120
124
|
<div data-carousel-dots class="mt-4 hidden justify-center"></div>
|
|
121
125
|
</div>
|
|
122
126
|
|
|
123
|
-
<style is:global>
|
|
124
|
-
/* Hide the scrollbar while keeping the track scrollable/swipable. */
|
|
125
|
-
.cc-track {
|
|
126
|
-
-ms-overflow-style: none;
|
|
127
|
-
scrollbar-width: none;
|
|
128
|
-
}
|
|
129
|
-
.cc-track::-webkit-scrollbar {
|
|
130
|
-
display: none;
|
|
131
|
-
}
|
|
132
|
-
/* The track is a keyboard focus stop (tabindex="0", role="group"), so it needs its own visible focus ring. */
|
|
133
|
-
.cc-track:focus-visible {
|
|
134
|
-
outline: 2px solid var(--color-primary);
|
|
135
|
-
outline-offset: 2px;
|
|
136
|
-
border-radius: var(--radius-lg, 8px);
|
|
137
|
-
}
|
|
138
|
-
</style>
|
|
139
|
-
|
|
140
127
|
<script>
|
|
141
128
|
import { initCarousels } from './carousel.ts';
|
|
142
129
|
|
package/src/composed/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ export { default as InlineImage } from './InlineImage.astro';
|
|
|
8
8
|
export { default as Pagination } from './Pagination.astro';
|
|
9
9
|
export { default as EntityCard } from './EntityCard.astro';
|
|
10
10
|
export { default as ArrowLinkGrid } from './ArrowLinkGrid.astro';
|
|
11
|
-
// RelatedContent sits here, not in ./editorial: it renders CardCarousel, whose <style> ships to every importer of the barrel.
|
|
12
11
|
export { default as RelatedContent } from './RelatedContent.astro';
|
|
13
12
|
export { default as RelatedContentCard } from './RelatedContentCard.astro';
|
|
14
13
|
export { default as RelatedContentGrid } from './RelatedContentGrid.astro';
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
7
7
|
import TableOfContents from '../composed/TableOfContents.astro';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import EraDossiers from './EraDossiers.astro';
|
|
9
|
+
import EraEntryRow from './EraEntryRow.astro';
|
|
10
10
|
import { LABELS } from '../internal/labels';
|
|
11
|
-
import type
|
|
11
|
+
import { orderEras, orphanEraIds, type TimelineItem } from './chronology';
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
14
|
eras: readonly EraDefinition[];
|
|
@@ -37,8 +37,7 @@ const {
|
|
|
37
37
|
class: className,
|
|
38
38
|
} = Astro.props;
|
|
39
39
|
|
|
40
|
-
const
|
|
41
|
-
const rows = ordered.map((era) => {
|
|
40
|
+
const rows = orderEras(eras).map((era) => {
|
|
42
41
|
const entries = items[era.id] ?? [];
|
|
43
42
|
const dated = entries.filter((item) => item.yearLabel);
|
|
44
43
|
const undated = entries.filter((item) => !item.yearLabel);
|
|
@@ -50,12 +49,9 @@ const rows = ordered.map((era) => {
|
|
|
50
49
|
const fullEras = rows.filter((r) => r.full).map((r) => r.era);
|
|
51
50
|
|
|
52
51
|
if (import.meta.env.DEV) {
|
|
53
|
-
const
|
|
54
|
-
const orphans = Object.keys(items).filter((id) => !known.has(id) && items[id].length);
|
|
52
|
+
const orphans = orphanEraIds(eras, items);
|
|
55
53
|
if (orphans.length) console.warn(`ChronologyTimeline: entries for unknown era id(s) ${orphans.join(', ')} are not rendered.`);
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
const thumbSizes = '(min-width: 640px) 128px, 64px';
|
|
59
55
|
---
|
|
60
56
|
|
|
61
57
|
<div class:list={['w-full', className]} data-chronology>
|
|
@@ -83,45 +79,11 @@ const thumbSizes = '(min-width: 640px) 128px, 64px';
|
|
|
83
79
|
<>
|
|
84
80
|
{run.label && <p id={`${era.anchor}-undated`} class="mt-8 text-sm font-semibold text-muted-foreground">{run.label}</p>}
|
|
85
81
|
<ol aria-labelledby={run.label ? `${era.anchor}-undated` : undefined} class:list={[run.label ? 'mt-3' : 'mt-8', 'divide-y divide-border border-y border-border']}>
|
|
86
|
-
{run.entries.map((item) =>
|
|
87
|
-
<li class="group/entry relative flex items-start gap-3 py-5 sm:gap-6">
|
|
88
|
-
<div class="min-w-0 flex-1">
|
|
89
|
-
<h3 class="text-lg font-semibold leading-snug text-foreground text-pretty">
|
|
90
|
-
<a href={item.href} class="rounded-sm transition-colors group-hover/entry:text-primary focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-ring after:absolute after:inset-0">{item.title}</a>
|
|
91
|
-
</h3>
|
|
92
|
-
<p class="mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-sm text-muted-foreground">
|
|
93
|
-
{item.yearLabel && <span class="tabular-nums font-medium text-foreground">{item.yearLabel}</span>}
|
|
94
|
-
{item.yearLabel && <span aria-hidden="true">·</span>}
|
|
95
|
-
<span>{item.kind}</span>
|
|
96
|
-
</p>
|
|
97
|
-
{item.description && (
|
|
98
|
-
<p class="mt-2 line-clamp-3 max-w-measure text-base leading-relaxed text-muted-foreground sm:line-clamp-none">{item.description}</p>
|
|
99
|
-
)}
|
|
100
|
-
</div>
|
|
101
|
-
{item.image && (
|
|
102
|
-
<div class="w-16 shrink-0 overflow-hidden rounded-md bg-muted aspect-[4/3] sm:w-32">
|
|
103
|
-
{typeof item.image === 'string' ? (
|
|
104
|
-
<img src={item.image} alt="" width="128" height="96" loading="lazy" decoding="async" class="size-full object-cover" />
|
|
105
|
-
) : (
|
|
106
|
-
<ResponsivePicture src={item.image} alt="" sizes={thumbSizes} loading="lazy" decoding="async" class="size-full object-cover" />
|
|
107
|
-
)}
|
|
108
|
-
</div>
|
|
109
|
-
)}
|
|
110
|
-
</li>
|
|
111
|
-
))}
|
|
82
|
+
{run.entries.map((item) => <EraEntryRow item={item} headingLevel={3} />)}
|
|
112
83
|
</ol>
|
|
113
84
|
</>
|
|
114
85
|
))}
|
|
115
|
-
{era
|
|
116
|
-
<div class="mt-8">
|
|
117
|
-
<p id={`${era.anchor}-dossiers`} class="text-sm font-semibold text-foreground">{dossiersLabel}</p>
|
|
118
|
-
<ul aria-labelledby={`${era.anchor}-dossiers`} class="mt-2 flex flex-wrap gap-x-6">
|
|
119
|
-
{era.dossiers.map((d) => (
|
|
120
|
-
<li><LinkArrow href={d.href} color="secondary" class="min-h-11">{d.label}</LinkArrow></li>
|
|
121
|
-
))}
|
|
122
|
-
</ul>
|
|
123
|
-
</div>
|
|
124
|
-
)}
|
|
86
|
+
<EraDossiers era={era} label={dossiersLabel} />
|
|
125
87
|
</div>
|
|
126
88
|
</li>
|
|
127
89
|
) : (
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
/** The "go deeper" links under an era; renders nothing without dossiers. */
|
|
3
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
4
|
+
import LinkArrow from '../primitives/LinkArrow.astro';
|
|
5
|
+
import { LABELS } from '../internal/labels';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
era: EraDefinition;
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { era, label = LABELS.chronologyTimeline.dossiersLabel } = Astro.props;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
{era.dossiers && era.dossiers.length > 0 && (
|
|
16
|
+
<div class="mt-8">
|
|
17
|
+
<p id={`${era.anchor}-dossiers`} class="text-sm font-semibold text-foreground">{label}</p>
|
|
18
|
+
<ul aria-labelledby={`${era.anchor}-dossiers`} class="mt-2 flex flex-wrap gap-x-6">
|
|
19
|
+
{era.dossiers.map((d) => (
|
|
20
|
+
<li><LinkArrow href={d.href} color="secondary" class="min-h-11">{d.label}</LinkArrow></li>
|
|
21
|
+
))}
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
)}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
/** One dated entry of an era: title link covering the row, year and kind, description, optional thumbnail. */
|
|
3
|
+
import Thumb from './Thumb.astro';
|
|
4
|
+
import type { TimelineItem } from './chronology';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
item: TimelineItem;
|
|
8
|
+
headingLevel: 3 | 4;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { item, headingLevel } = Astro.props;
|
|
12
|
+
const Heading = `h${headingLevel}` as const;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<li class="group/entry relative flex items-start gap-3 py-5 sm:gap-6">
|
|
16
|
+
<div class="min-w-0 flex-1">
|
|
17
|
+
<Heading class="text-lg font-semibold leading-snug text-foreground text-pretty">
|
|
18
|
+
<a href={item.href} class="rounded-sm transition-colors group-hover/entry:text-primary focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-ring after:absolute after:inset-0">{item.title}</a>
|
|
19
|
+
</Heading>
|
|
20
|
+
<p class="mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-sm text-muted-foreground">
|
|
21
|
+
{item.yearLabel && <span class="tabular-nums font-medium text-foreground">{item.yearLabel}</span>}
|
|
22
|
+
{item.yearLabel && <span aria-hidden="true">·</span>}
|
|
23
|
+
<span>{item.kind}</span>
|
|
24
|
+
</p>
|
|
25
|
+
{item.description && (
|
|
26
|
+
<p class="mt-2 line-clamp-3 max-w-measure text-base leading-relaxed text-muted-foreground sm:line-clamp-none">{item.description}</p>
|
|
27
|
+
)}
|
|
28
|
+
</div>
|
|
29
|
+
{item.image && (
|
|
30
|
+
<div class="w-16 shrink-0 overflow-hidden rounded-md bg-muted aspect-[4/3] sm:w-32">
|
|
31
|
+
<Thumb image={item.image} sizes="(min-width: 640px) 128px, 64px" width={128} height={96} />
|
|
32
|
+
</div>
|
|
33
|
+
)}
|
|
34
|
+
</li>
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* EraScenes — a site's eras as stacked scenes, one per era: hero (image, date range, title, hook), a cast row of
|
|
4
|
+
* faces and buildings that anchors to the strips below, the era's intro, then people, monuments and articles.
|
|
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 people or monuments strip keeps its heading and says so; an era with no
|
|
7
|
+
* entries at all still renders its scene, so eraHref() links never dead-end. Without `era.image` the header is a
|
|
8
|
+
* plain bordered panel. Scenes alternate a muted tint. Only the first scene's hero loads eagerly.
|
|
9
|
+
* The `index` ToC jumps between eras; `data-chronology-era` marks each scene for its scrollspy.
|
|
10
|
+
*/
|
|
11
|
+
import type { ImageMetadata } from 'astro';
|
|
12
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
13
|
+
import CardCarousel from '../composed/CardCarousel.astro';
|
|
14
|
+
import TableOfContents from '../composed/TableOfContents.astro';
|
|
15
|
+
import EntityCard from '../composed/EntityCard.astro';
|
|
16
|
+
import Container from '../layout/Container.astro';
|
|
17
|
+
import Icon from '../primitives/Icon.astro';
|
|
18
|
+
import ResponsivePicture from '../primitives/ResponsivePicture.astro';
|
|
19
|
+
import PersonCard from './PersonCard.astro';
|
|
20
|
+
import CardPlaceholder from './CardPlaceholder.astro';
|
|
21
|
+
import EraDossiers from './EraDossiers.astro';
|
|
22
|
+
import EraEntryRow from './EraEntryRow.astro';
|
|
23
|
+
import Thumb from './Thumb.astro';
|
|
24
|
+
import { LABELS } from '../internal/labels';
|
|
25
|
+
import { orderEras, orphanEraIds, splitScene, type SceneItem } from './chronology';
|
|
26
|
+
|
|
27
|
+
type SceneLabels = typeof LABELS.eraScenes;
|
|
28
|
+
|
|
29
|
+
interface Props {
|
|
30
|
+
eras: readonly EraDefinition[];
|
|
31
|
+
/** Entries keyed by era id, already ordered (people and monuments by year, articles newest first). */
|
|
32
|
+
items: Record<string, readonly SceneItem[]>;
|
|
33
|
+
/** The jump links above the scenes. */
|
|
34
|
+
index?: boolean;
|
|
35
|
+
castLimit?: number;
|
|
36
|
+
articleLimit?: number;
|
|
37
|
+
labels?: Partial<SceneLabels>;
|
|
38
|
+
class?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const { eras, items, index = true, castLimit = 6, articleLimit = 5, labels, class: className } = Astro.props;
|
|
42
|
+
const L: SceneLabels = { ...LABELS.eraScenes, ...labels };
|
|
43
|
+
|
|
44
|
+
const scenes = orderEras(eras).map((era) => ({ era, scene: splitScene(items[era.id] ?? [], { castLimit, articleLimit }) }));
|
|
45
|
+
|
|
46
|
+
if (import.meta.env.DEV) {
|
|
47
|
+
const orphans = orphanEraIds(eras, items);
|
|
48
|
+
if (orphans.length) console.warn(`EraScenes: entries for unknown era id(s) ${orphans.join(', ')} are not rendered.`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const asImage = (image: SceneItem['image']): ImageMetadata | undefined => (typeof image === 'object' ? image : undefined);
|
|
52
|
+
const asSrc = (image: SceneItem['image']): string | undefined => (typeof image === 'string' ? image : undefined);
|
|
53
|
+
const cardWidth = 'snap-start shrink-0 w-[72vw] sm:w-60';
|
|
54
|
+
const stripHeading = 'font-display text-2xl text-foreground';
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<div data-era-scenes class:list={['w-full', className]}>
|
|
58
|
+
{index && scenes.length > 1 && (
|
|
59
|
+
<Container class="pb-8 md:pb-12">
|
|
60
|
+
<TableOfContents
|
|
61
|
+
showHeader={false}
|
|
62
|
+
ariaLabel={L.indexLabel}
|
|
63
|
+
items={scenes.map(({ era }) => ({ label: era.label, href: `#${era.anchor}` }))}
|
|
64
|
+
sectionSelector="[data-chronology-era]"
|
|
65
|
+
hideMiniPastLastSection
|
|
66
|
+
/>
|
|
67
|
+
</Container>
|
|
68
|
+
)}
|
|
69
|
+
{scenes.map(({ era, scene }, n) => {
|
|
70
|
+
const cast = scene.cast.map((item) => {
|
|
71
|
+
const list = item.type === 'person' ? scene.people : scene.monuments;
|
|
72
|
+
return { item, href: `#${era.anchor}-${item.type}-${list.indexOf(item)}` };
|
|
73
|
+
});
|
|
74
|
+
const hero = era.image;
|
|
75
|
+
return (
|
|
76
|
+
<section
|
|
77
|
+
id={era.anchor}
|
|
78
|
+
data-chronology-era={era.id}
|
|
79
|
+
aria-labelledby={`${era.anchor}-title`}
|
|
80
|
+
class:list={['scroll-mt-28 py-10 md:py-14', n % 2 === 1 && 'bg-muted/30']}
|
|
81
|
+
>
|
|
82
|
+
<Container>
|
|
83
|
+
<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']}>
|
|
84
|
+
{hero && (
|
|
85
|
+
<>
|
|
86
|
+
<ResponsivePicture
|
|
87
|
+
src={hero}
|
|
88
|
+
alt=""
|
|
89
|
+
sizes="(min-width: 1152px) 1152px, 100vw"
|
|
90
|
+
loading={n === 0 ? 'eager' : 'lazy'}
|
|
91
|
+
fetchpriority={n === 0 ? 'high' : undefined}
|
|
92
|
+
decoding="async"
|
|
93
|
+
pictureAttributes={{ class: 'absolute inset-0 -z-10' }}
|
|
94
|
+
class="size-full object-cover"
|
|
95
|
+
/>
|
|
96
|
+
<div class="absolute inset-0 -z-10 bg-gradient-to-t from-overlay/90 via-overlay/45 to-transparent" aria-hidden="true"></div>
|
|
97
|
+
</>
|
|
98
|
+
)}
|
|
99
|
+
<div class:list={['relative w-full p-5 sm:p-8', hero ? 'text-overlay-foreground' : 'text-foreground']}>
|
|
100
|
+
<p class="font-display text-5xl leading-none tabular-nums sm:text-6xl md:text-7xl">{era.rangeLabel}</p>
|
|
101
|
+
<h2 id={`${era.anchor}-title`} class="mt-3 font-display text-2xl leading-tight text-balance sm:text-3xl md:text-4xl">{era.label}</h2>
|
|
102
|
+
{era.hook && <p class:list={['mt-2 max-w-measure text-lg leading-snug', hero ? 'text-overlay-foreground/90' : 'text-muted-foreground']}>{era.hook}</p>}
|
|
103
|
+
</div>
|
|
104
|
+
</header>
|
|
105
|
+
|
|
106
|
+
{cast.length > 0 && (
|
|
107
|
+
<div class="mt-8" data-era-cast>
|
|
108
|
+
<p id={`${era.anchor}-cast`} class="text-sm font-semibold text-muted-foreground">{L.castLabel}</p>
|
|
109
|
+
<ul aria-labelledby={`${era.anchor}-cast`} class="mt-3 flex flex-wrap gap-x-4 gap-y-3">
|
|
110
|
+
{cast.map(({ item, href }) => (
|
|
111
|
+
<li class="w-20">
|
|
112
|
+
<a href={href} class="group flex flex-col gap-1.5 rounded-lg focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-ring">
|
|
113
|
+
<span class="block aspect-square overflow-hidden rounded-lg bg-muted">
|
|
114
|
+
<Thumb image={item.image!} sizes="80px" width={80} height={80} pictureAttributes={{ class: 'block size-full' }} />
|
|
115
|
+
</span>
|
|
116
|
+
<span class="line-clamp-2 text-sm leading-tight text-foreground group-hover:text-primary">{item.title}</span>
|
|
117
|
+
</a>
|
|
118
|
+
</li>
|
|
119
|
+
))}
|
|
120
|
+
</ul>
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
<p class="mt-8 max-w-measure text-lg leading-relaxed text-foreground">{era.intro}</p>
|
|
125
|
+
|
|
126
|
+
<div class="mt-10">
|
|
127
|
+
{scene.people.length > 0 ? (
|
|
128
|
+
<CardCarousel id={`${era.anchor}-people`} heading={L.peopleHeading} headingTag="h3" headingClass={stripHeading} ariaLabel={`${era.label}: ${L.peopleHeading}`}>
|
|
129
|
+
{scene.people.map((item, i) => (
|
|
130
|
+
<div id={`${era.anchor}-person-${i}`} class={`${cardWidth} scroll-mt-28`}>
|
|
131
|
+
<PersonCard
|
|
132
|
+
href={item.href}
|
|
133
|
+
name={item.title}
|
|
134
|
+
image={asImage(item.image)}
|
|
135
|
+
fallbackSrc={asSrc(item.image)}
|
|
136
|
+
imageAlt={L.portraitAlt(item.title)}
|
|
137
|
+
dates={item.yearLabel}
|
|
138
|
+
roles={item.roles}
|
|
139
|
+
knownFor={item.description}
|
|
140
|
+
headingLevel={4}
|
|
141
|
+
sizes="(max-width: 639px) 72vw, 240px"
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
))}
|
|
145
|
+
</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
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div class="mt-10">
|
|
155
|
+
<h3 id={`${era.anchor}-monuments`} class={stripHeading}>{L.monumentsHeading}</h3>
|
|
156
|
+
{scene.monuments.length > 0 ? (
|
|
157
|
+
<div class="mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
|
158
|
+
{scene.monuments.map((item, i) => (
|
|
159
|
+
<div id={`${era.anchor}-monument-${i}`} class="scroll-mt-28">
|
|
160
|
+
<EntityCard
|
|
161
|
+
href={item.href}
|
|
162
|
+
variant="poster"
|
|
163
|
+
mediaClass="aspect-[4/3]"
|
|
164
|
+
image={asImage(item.image)}
|
|
165
|
+
fallbackSrc={asSrc(item.image)}
|
|
166
|
+
imageAlt=""
|
|
167
|
+
sizes="(max-width: 639px) 100vw, (max-width: 1023px) 50vw, 360px"
|
|
168
|
+
footer={false}
|
|
169
|
+
>
|
|
170
|
+
<CardPlaceholder slot="fallback">
|
|
171
|
+
<Icon name="landmark" class="size-10 text-primary/60" />
|
|
172
|
+
</CardPlaceholder>
|
|
173
|
+
<h4 class="text-lg font-semibold leading-snug text-foreground text-pretty">{item.title}</h4>
|
|
174
|
+
<p class="mt-1 flex flex-wrap gap-x-2 text-sm text-muted-foreground">
|
|
175
|
+
{item.yearLabel && <span class="tabular-nums font-medium text-foreground">{item.yearLabel}</span>}
|
|
176
|
+
{item.yearLabel && <span aria-hidden="true">·</span>}
|
|
177
|
+
<span>{item.kind}</span>
|
|
178
|
+
</p>
|
|
179
|
+
{item.description && <p class="mt-2 line-clamp-3 text-sm leading-relaxed text-muted-foreground">{item.description}</p>}
|
|
180
|
+
</EntityCard>
|
|
181
|
+
</div>
|
|
182
|
+
))}
|
|
183
|
+
</div>
|
|
184
|
+
) : (
|
|
185
|
+
<p class="mt-2 text-muted-foreground">{L.emptyMonuments}</p>
|
|
186
|
+
)}
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div class="mt-10">
|
|
190
|
+
<h3 id={`${era.anchor}-articles`} class={stripHeading}>{L.articlesHeading}</h3>
|
|
191
|
+
{scene.articles.length > 0 ? (
|
|
192
|
+
<ol aria-labelledby={`${era.anchor}-articles`} class="mt-4 divide-y divide-border border-y border-border">
|
|
193
|
+
{scene.articles.map((item) => <EraEntryRow item={item} headingLevel={4} />)}
|
|
194
|
+
</ol>
|
|
195
|
+
) : (
|
|
196
|
+
<p class="mt-2 text-muted-foreground">{L.emptyArticles}</p>
|
|
197
|
+
)}
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<EraDossiers era={era} label={L.dossiersLabel} />
|
|
201
|
+
</Container>
|
|
202
|
+
</section>
|
|
203
|
+
);
|
|
204
|
+
})}
|
|
205
|
+
</div>
|
|
@@ -32,7 +32,7 @@ interface Props {
|
|
|
32
32
|
/** Deprecated: clamped fallback when `knownFor` is absent. */
|
|
33
33
|
description?: string;
|
|
34
34
|
ctaLabel?: string;
|
|
35
|
-
headingLevel?: 2 | 3;
|
|
35
|
+
headingLevel?: 2 | 3 | 4;
|
|
36
36
|
index?: number;
|
|
37
37
|
eager?: number;
|
|
38
38
|
sizes?: string;
|
|
@@ -59,7 +59,7 @@ const {
|
|
|
59
59
|
class: className,
|
|
60
60
|
} = Astro.props;
|
|
61
61
|
|
|
62
|
-
const Heading = `h${headingLevel}` as 'h2' | 'h3';
|
|
62
|
+
const Heading = `h${headingLevel}` as 'h2' | 'h3' | 'h4';
|
|
63
63
|
const initials = monogram ?? initialsOf(name);
|
|
64
64
|
---
|
|
65
65
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* the lifespan as typography; portrait as the backdrop, else a monogram panel), a quiet key-facts strip (aliases,
|
|
7
7
|
* optional `contextFact`), a short sticky ToC only when the bio runs past four paragraphs, the bio with its first
|
|
8
8
|
* paragraph as the lead, the featured full-story card, places to see, the era on a ChronologyTimeline, then up to
|
|
9
|
-
* four related reads (`RelatedContentGrid`, not `RelatedContent`: the person page owns its headings
|
|
10
|
-
*
|
|
9
|
+
* four related reads (`RelatedContentGrid`, not `RelatedContent`: the person page owns its headings).
|
|
10
|
+
* Every string is a prop or a LABELS default; a block with no data
|
|
11
11
|
* renders nothing. The lifespan reads "Lived c. 1138–1204 (about 66 years)" from `birthYear`/`deathYear`/`circa`,
|
|
12
12
|
* or from a pre-formatted `lifespan` or `dates` (both shown as is). `readMore` is ranked by the caller: the first
|
|
13
13
|
* `readMoreLimit` (four) render, so the route passes the best reads first. Slots:
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
/** A decorative (alt="") image that is either an imported asset or a plain URL; the caller sizes the box. */
|
|
3
|
+
import type { ImageMetadata } from 'astro';
|
|
4
|
+
import ResponsivePicture from '../primitives/ResponsivePicture.astro';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
image: ImageMetadata | string;
|
|
8
|
+
sizes: string;
|
|
9
|
+
/** Intrinsic size of the plain-URL `<img>`. */
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
pictureAttributes?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { image, sizes, width, height, pictureAttributes } = Astro.props;
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
{typeof image === 'string' ? (
|
|
19
|
+
<img src={image} alt="" width={width} height={height} loading="lazy" decoding="async" class="size-full object-cover" />
|
|
20
|
+
) : (
|
|
21
|
+
<ResponsivePicture src={image} alt="" sizes={sizes} loading="lazy" decoding="async" pictureAttributes={pictureAttributes} class="size-full object-cover" />
|
|
22
|
+
)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ImageMetadata } from 'astro';
|
|
2
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
2
3
|
|
|
3
4
|
/** One entry on a ChronologyTimeline era. `kind` and `yearLabel` are site copy, rendered verbatim. */
|
|
4
5
|
export interface TimelineItem {
|
|
@@ -11,6 +12,49 @@ export interface TimelineItem {
|
|
|
11
12
|
image?: ImageMetadata | string;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
export type SceneKind = 'person' | 'monument' | 'article';
|
|
16
|
+
|
|
17
|
+
/** One entry of an EraScenes era: a TimelineItem plus the strip it belongs to. */
|
|
18
|
+
export interface SceneItem extends TimelineItem {
|
|
19
|
+
type: SceneKind;
|
|
20
|
+
/** Sort year (historians' years, negative = BCE); the cast orders by it. */
|
|
21
|
+
year?: number;
|
|
22
|
+
/** People only: display role labels. */
|
|
23
|
+
roles?: readonly string[];
|
|
24
|
+
featured?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface EraScene {
|
|
28
|
+
cast: SceneItem[];
|
|
29
|
+
people: SceneItem[];
|
|
30
|
+
monuments: SceneItem[];
|
|
31
|
+
articles: SceneItem[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Splits one era's entries into its strips. People and monuments keep the given order; articles keep it and are
|
|
36
|
+
* capped at `articleLimit` (the caller orders them, e.g. newest first). The cast is the people and monuments that
|
|
37
|
+
* have an image, featured first, then by year (entries without one last), capped at `castLimit`. Not mutating.
|
|
38
|
+
*/
|
|
39
|
+
export function splitScene(
|
|
40
|
+
entries: readonly SceneItem[],
|
|
41
|
+
{ castLimit = 6, articleLimit = 5 }: { castLimit?: number; articleLimit?: number } = {},
|
|
42
|
+
): EraScene {
|
|
43
|
+
const of = (type: SceneKind) => entries.filter((e) => e.type === type);
|
|
44
|
+
const people = of('person');
|
|
45
|
+
const monuments = of('monument');
|
|
46
|
+
const rank = (e: SceneItem) => [e.featured ? 0 : 1, e.year === undefined ? 1 : 0, e.year ?? 0] as const;
|
|
47
|
+
const cast = [...people, ...monuments]
|
|
48
|
+
.filter((e) => e.image)
|
|
49
|
+
.sort((a, b) => {
|
|
50
|
+
const [fa, ua, ya] = rank(a);
|
|
51
|
+
const [fb, ub, yb] = rank(b);
|
|
52
|
+
return fa - fb || ua - ub || ya - yb;
|
|
53
|
+
})
|
|
54
|
+
.slice(0, castLimit);
|
|
55
|
+
return { cast, people, monuments, articles: of('article').slice(0, articleLimit) };
|
|
56
|
+
}
|
|
57
|
+
|
|
14
58
|
/**
|
|
15
59
|
* Groups entries by era id and orders each group by year (entries without a year last), then by title. Entries whose
|
|
16
60
|
* era is undefined are dropped. The input is not mutated.
|
|
@@ -43,3 +87,14 @@ export function groupByEra<T>(
|
|
|
43
87
|
}
|
|
44
88
|
return groups;
|
|
45
89
|
}
|
|
90
|
+
|
|
91
|
+
/** The eras oldest first; the input is not mutated. */
|
|
92
|
+
export function orderEras(eras: readonly EraDefinition[]): EraDefinition[] {
|
|
93
|
+
return [...eras].sort((a, b) => a.startYear - b.startYear);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Era ids in `items` that carry entries but match no era, so nothing renders them. */
|
|
97
|
+
export function orphanEraIds(eras: readonly EraDefinition[], items: Record<string, readonly unknown[]>): string[] {
|
|
98
|
+
const known = new Set(eras.map((e) => e.id));
|
|
99
|
+
return Object.keys(items).filter((id) => !known.has(id) && items[id].length);
|
|
100
|
+
}
|
package/src/editorial/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// Public surface of @sarimarcus/content-sites-ui/editorial.
|
|
2
2
|
export { default as EditorialGuidePage } from './EditorialGuidePage.astro';
|
|
3
|
+
export { default as EraScenes } from './EraScenes.astro';
|
|
4
|
+
export { splitScene } from './chronology';
|
|
5
|
+
export type { SceneItem, SceneKind, EraScene } from './chronology';
|
|
3
6
|
export { default as EventPage } from './EventPage.astro';
|
|
4
7
|
export { default as BeforeYouGo } from './BeforeYouGo.astro';
|
|
5
8
|
export { default as NumberedStep } from './NumberedStep.astro';
|
package/src/internal/labels.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// The English copy ui components fall back to when the site passes no prop (SLA-2991). A template never writes
|
|
2
2
|
// reader-visible text itself (validate-packages refuses it); it reads a prop whose default is here.
|
|
3
|
+
// Shared by ChronologyTimeline and EraScenes, so the two cannot drift.
|
|
4
|
+
const eraLabels = { indexLabel: 'Eras', dossiersLabel: 'Go deeper' };
|
|
5
|
+
|
|
3
6
|
export const LABELS = {
|
|
4
7
|
affiliateCard: {
|
|
5
8
|
pricePrefix: 'From ',
|
|
@@ -116,9 +119,19 @@ export const LABELS = {
|
|
|
116
119
|
},
|
|
117
120
|
breadcrumb: { homeLabel: 'Home', ariaLabel: 'Breadcrumb navigation' },
|
|
118
121
|
chronologyTimeline: {
|
|
119
|
-
|
|
120
|
-
dossiersLabel: 'Go deeper',
|
|
122
|
+
...eraLabels,
|
|
121
123
|
emptyLabel: '',
|
|
122
124
|
undatedLabel: 'Undated',
|
|
123
125
|
},
|
|
126
|
+
eraScenes: {
|
|
127
|
+
...eraLabels,
|
|
128
|
+
castLabel: 'In this era',
|
|
129
|
+
peopleHeading: 'People',
|
|
130
|
+
monumentsHeading: 'Monuments',
|
|
131
|
+
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
|
+
portraitAlt: (name: string) => `Portrait of ${name}`,
|
|
136
|
+
},
|
|
124
137
|
};
|
package/src/styles/tailwind.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
package's own templates are scanned: @import "@sarimarcus/content-sites-ui/tailwind.css"; */
|
|
3
3
|
@source "..";
|
|
4
4
|
|
|
5
|
-
/* Horizontal scrollers that keep scrolling but draw no scrollbar (Breadcrumb, TableOfContents). */
|
|
5
|
+
/* Horizontal scrollers that keep scrolling but draw no scrollbar (Breadcrumb, TableOfContents, CardCarousel). */
|
|
6
6
|
@utility scrollbar-hide {
|
|
7
7
|
-ms-overflow-style: none;
|
|
8
8
|
scrollbar-width: none;
|