@sarimarcus/content-sites-ui 0.54.1 → 0.55.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 +8 -0
- package/README.md +5 -1
- package/package.json +2 -2
- package/src/affiliate/AffiliateCard.astro +10 -8
- package/src/affiliate/AffiliateCardSection.astro +5 -2
- package/src/affiliate/AffiliateCarousel.astro +6 -2
- package/src/affiliate/AffiliateComparisonTable.astro +14 -11
- package/src/affiliate/AmazonProductCard.astro +3 -2
- package/src/affiliate/AmazonProductSection.astro +5 -3
- package/src/affiliate/HotelAffiliateCTA.astro +15 -12
- package/src/affiliate/InlineAffiliateCTA.astro +3 -2
- package/src/affiliate/StickyCTA.astro +7 -4
- package/src/affiliate/TravelpayoutsWidget.astro +3 -2
- package/src/affiliate/cardItem.ts +1 -1
- package/src/composed/CardCarousel.astro +8 -5
- package/src/composed/FAQ.astro +3 -2
- package/src/composed/Pagination.astro +9 -6
- package/src/composed/TableOfContents.astro +7 -4
- package/src/editorial/AlsoExplore.astro +3 -2
- package/src/editorial/ArticleCategoryNav.astro +6 -3
- package/src/editorial/ArticleFeatureCard.astro +5 -2
- package/src/editorial/ArticleTopicPager.astro +9 -6
- package/src/editorial/AuthorPage.astro +292 -0
- package/src/editorial/AuthorsIndexPage.astro +127 -0
- package/src/editorial/ChronologyTimeline.astro +12 -7
- package/src/editorial/DossierSection.astro +7 -4
- package/src/editorial/EraChip.astro +5 -2
- package/src/editorial/EraDossiers.astro +3 -2
- package/src/editorial/EraPeopleRow.astro +10 -6
- package/src/editorial/EraScenes.astro +9 -6
- package/src/editorial/EraTimelineNav.astro +3 -2
- package/src/editorial/EventEditionBadge.astro +6 -4
- package/src/editorial/EventEditionBanner.astro +8 -5
- package/src/editorial/EventPage.astro +1 -1
- package/src/editorial/NotFoundPage.astro +5 -2
- package/src/editorial/PeopleBand.astro +5 -3
- package/src/editorial/PeopleChips.astro +4 -3
- package/src/editorial/PeopleHub.astro +11 -5
- package/src/editorial/PeopleTimeline.astro +7 -4
- package/src/editorial/PersonCard.astro +3 -2
- package/src/editorial/PersonChip.astro +3 -2
- package/src/editorial/PersonPage.astro +22 -17
- package/src/editorial/VisitTiming.astro +6 -3
- package/src/editorial/author-page.ts +113 -0
- package/src/editorial/chronology-page.ts +4 -2
- package/src/editorial/era-listing.ts +3 -2
- package/src/editorial/eventEdition.ts +3 -2
- package/src/editorial/index.ts +11 -0
- package/src/editorial/person-page.ts +5 -3
- package/src/internal/labels.ts +238 -0
- package/src/layout/DocumentShell.astro +7 -2
- package/src/navigation/ArticlesNavMenu.astro +4 -3
- package/src/navigation/SiteFooter.astro +7 -4
- package/src/navigation/SiteHeader.astro +7 -4
- package/src/navigation/types.ts +2 -0
- package/src/seo/ArticleMetadata.astro +9 -7
- package/src/seo/AuthoritativeSources.astro +20 -12
- package/src/seo/Breadcrumb.astro +6 -3
- package/src/seo/schemaContext.ts +2 -1
- package/src/seo/sourceLabels.ts +1 -0
- package/src/seo/types.ts +1 -1
|
@@ -24,7 +24,7 @@ import EraDossiers from './EraDossiers.astro';
|
|
|
24
24
|
import EraEntryRow from './EraEntryRow.astro';
|
|
25
25
|
import EraTimelineNav from './EraTimelineNav.astro';
|
|
26
26
|
import Thumb from './Thumb.astro';
|
|
27
|
-
import { LABELS } from '../internal/labels';
|
|
27
|
+
import { getLabels, type LABELS } from '../internal/labels';
|
|
28
28
|
import { orderEras, orphanEraIds, splitScene, type SceneItem } from './chronology';
|
|
29
29
|
|
|
30
30
|
type SceneLabels = typeof LABELS.eraScenes;
|
|
@@ -41,12 +41,13 @@ interface Props {
|
|
|
41
41
|
articleLimit?: number;
|
|
42
42
|
/** Per era id, the full article count and the listing page; the era's articles strip links to it when set. */
|
|
43
43
|
articleListings?: Record<string, { href: string; count: number }>;
|
|
44
|
+
locale?: string;
|
|
44
45
|
labels?: Partial<SceneLabels>;
|
|
45
46
|
class?: string;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
const { eras, items, index = true, indexStyle = 'chips', castLimit = 6, articleLimit = 5, articleListings = {}, labels, class: className } = Astro.props;
|
|
49
|
-
const L: SceneLabels = { ...
|
|
49
|
+
const { eras, items, index = true, indexStyle = 'chips', castLimit = 6, articleLimit = 5, articleListings = {}, locale, labels, class: className } = Astro.props;
|
|
50
|
+
const L: SceneLabels = { ...getLabels(locale ?? Astro.currentLocale).eraScenes, ...labels };
|
|
50
51
|
|
|
51
52
|
const scenes = orderEras(eras).map((era) => ({ era, scene: splitScene(items[era.id] ?? [], { castLimit, articleLimit }) }));
|
|
52
53
|
|
|
@@ -64,7 +65,7 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
64
65
|
---
|
|
65
66
|
|
|
66
67
|
<div data-era-scenes class:list={['w-full', className]}>
|
|
67
|
-
{index && scenes.length > 1 && indexStyle === 'timeline' && <EraTimelineNav eras={scenes.map((s) => s.era)} ariaLabel={L.indexLabel} />}{index && scenes.length > 1 && (
|
|
68
|
+
{index && scenes.length > 1 && indexStyle === 'timeline' && <EraTimelineNav eras={scenes.map((s) => s.era)} ariaLabel={L.indexLabel} locale={locale} />}{index && scenes.length > 1 && (
|
|
68
69
|
<Container class:list={['pb-8 md:pb-12', indexStyle === 'timeline' && 'md:hidden']}>
|
|
69
70
|
<TableOfContents
|
|
70
71
|
showHeader={false}
|
|
@@ -72,6 +73,7 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
72
73
|
items={scenes.map(({ era }) => ({ label: era.label, href: `#${era.anchor}` }))}
|
|
73
74
|
sectionSelector="[data-chronology-era]"
|
|
74
75
|
hideMiniPastLastSection
|
|
76
|
+
locale={locale}
|
|
75
77
|
/>
|
|
76
78
|
</Container>
|
|
77
79
|
)}
|
|
@@ -147,7 +149,7 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
147
149
|
|
|
148
150
|
{scene.people.length > 0 && (
|
|
149
151
|
<div class="mt-10">
|
|
150
|
-
<CardCarousel id={`${era.anchor}-people`} heading={L.peopleHeading} headingTag="h3" headingClass={stripHeading} ariaLabel={`${era.label}: ${L.peopleHeading}`}>
|
|
152
|
+
<CardCarousel id={`${era.anchor}-people`} heading={L.peopleHeading} headingTag="h3" headingClass={stripHeading} ariaLabel={`${era.label}: ${L.peopleHeading}`} locale={locale}>
|
|
151
153
|
{scene.people.map((item, i) => (
|
|
152
154
|
<div id={`${era.anchor}-person-${i}`} class={`${cardWidth} ${scrollMt}`}>
|
|
153
155
|
<PersonCard
|
|
@@ -161,6 +163,7 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
161
163
|
knownFor={item.description}
|
|
162
164
|
headingLevel={4}
|
|
163
165
|
sizes="(max-width: 639px) 72vw, 240px"
|
|
166
|
+
locale={locale}
|
|
164
167
|
/>
|
|
165
168
|
</div>
|
|
166
169
|
))}
|
|
@@ -212,7 +215,7 @@ const stripHeading = 'font-display text-2xl text-foreground';
|
|
|
212
215
|
</div>
|
|
213
216
|
)}
|
|
214
217
|
|
|
215
|
-
<EraDossiers era={era} label={L.dossiersLabel} />
|
|
218
|
+
<EraDossiers era={era} label={L.dossiersLabel} locale={locale} />
|
|
216
219
|
</Container>
|
|
217
220
|
</section>
|
|
218
221
|
);
|
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
* toc.ts into a shared chunk and the controller stops inlining).
|
|
8
8
|
*/
|
|
9
9
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
10
|
-
import {
|
|
10
|
+
import { getLabels } from '../internal/labels';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
eras: readonly EraDefinition[];
|
|
14
14
|
ariaLabel?: string;
|
|
15
15
|
sectionSelector?: string;
|
|
16
|
+
locale?: string;
|
|
16
17
|
class?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
const { eras, ariaLabel =
|
|
20
|
+
const { eras, ariaLabel = getLabels(Astro.props.locale ?? Astro.currentLocale).eraTimelineNav.ariaLabel, sectionSelector = '[data-chronology-era]', class: className } = Astro.props;
|
|
20
21
|
---
|
|
21
22
|
|
|
22
23
|
{eras.length > 1 && (
|
|
@@ -3,21 +3,23 @@
|
|
|
3
3
|
// It renders nothing for an undated, upcoming or running event, so a page that adds it changes only when its
|
|
4
4
|
// event is over. A site keeps its own "happening now" / "upcoming" pills.
|
|
5
5
|
import Badge from '../primitives/Badge.astro';
|
|
6
|
-
import {
|
|
6
|
+
import { getLabels } from '../internal/labels';
|
|
7
7
|
import { editionDateLabel, eventEdition } from './eventEdition';
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
startDate?: string;
|
|
11
11
|
endDate?: string;
|
|
12
|
-
/** The pill text for the day the edition ended; defaults to the
|
|
12
|
+
/** The pill text for the day the edition ended; defaults to the locale label. */
|
|
13
13
|
pastLabel?: (date: string) => string;
|
|
14
|
+
/** BCP-47 locale for the date and default label (defaults to `en-GB`). */
|
|
15
|
+
locale?: string;
|
|
14
16
|
/** Pins today for tests; defaults to the Madrid day. */
|
|
15
17
|
today?: string;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
const { startDate, endDate, pastLabel =
|
|
20
|
+
const { startDate, endDate, locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB', pastLabel = getLabels(locale).eventEdition.pastBadge, today } = Astro.props;
|
|
19
21
|
const { state, endDay } = eventEdition({ startDate, endDate }, today);
|
|
20
|
-
const label = state === 'past' ? pastLabel(editionDateLabel(endDay
|
|
22
|
+
const label = state === 'past' ? pastLabel(editionDateLabel(endDay!, locale)) : '';
|
|
21
23
|
---
|
|
22
24
|
|
|
23
25
|
{state === 'past' && (
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// EventEditionBanner: a short note above the body of a page about an event whose edition has ended (SLA-3435).
|
|
3
3
|
// It renders nothing for an undated, upcoming or running event. The page stays: it describes the last edition and
|
|
4
4
|
// points to the events hub for what is next. Gates key on `data-edition-banner`, never on its classes.
|
|
5
|
-
import {
|
|
5
|
+
import { getLabels } from '../internal/labels';
|
|
6
6
|
import { editionDateLabel, eventEdition } from './eventEdition';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -13,6 +13,8 @@ interface Props {
|
|
|
13
13
|
eventsLabel?: string;
|
|
14
14
|
leadLabel?: (date: string) => string;
|
|
15
15
|
tailLabel?: string;
|
|
16
|
+
/** BCP-47 locale for the date and default labels (defaults to `en-GB`). */
|
|
17
|
+
locale?: string;
|
|
16
18
|
/** Pins today for tests; defaults to the Madrid day. */
|
|
17
19
|
today?: string;
|
|
18
20
|
}
|
|
@@ -21,13 +23,14 @@ const {
|
|
|
21
23
|
startDate,
|
|
22
24
|
endDate,
|
|
23
25
|
eventsHref,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
|
|
27
|
+
eventsLabel = getLabels(locale).eventEdition.eventsLink,
|
|
28
|
+
leadLabel = getLabels(locale).eventEdition.bannerLead,
|
|
29
|
+
tailLabel = getLabels(locale).eventEdition.bannerTail,
|
|
27
30
|
today,
|
|
28
31
|
} = Astro.props;
|
|
29
32
|
const { state, endDay } = eventEdition({ startDate, endDate }, today);
|
|
30
|
-
const lead = state === 'past' ? leadLabel(editionDateLabel(endDay
|
|
33
|
+
const lead = state === 'past' ? leadLabel(editionDateLabel(endDay!, locale)) : '';
|
|
31
34
|
---
|
|
32
35
|
|
|
33
36
|
{state === 'past' && (
|
|
@@ -49,7 +49,7 @@ interface Props {
|
|
|
49
49
|
pagefindType?: string;
|
|
50
50
|
audiences?: readonly string[];
|
|
51
51
|
/** Dates and hub link for the past-edition banner (SLA-3435). Omit, or leave undated, and nothing renders. */
|
|
52
|
-
edition?: { startDate?: string; endDate?: string; eventsHref: string; eventsLabel?: string };
|
|
52
|
+
edition?: { startDate?: string; endDate?: string; eventsHref: string; eventsLabel?: string; locale?: string };
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import Button from '../primitives/Button.astro';
|
|
8
8
|
import LinkArrow from '../primitives/LinkArrow.astro';
|
|
9
9
|
import Icon from '../primitives/Icon.astro';
|
|
10
|
-
import {
|
|
10
|
+
import { getLabels } from '../internal/labels';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
tagline: string;
|
|
@@ -25,9 +25,12 @@ interface Props {
|
|
|
25
25
|
links: { href: string; label: string }[];
|
|
26
26
|
/** Classes of the search link; a dark theme passes its own border and background tokens. */
|
|
27
27
|
searchBoxClass?: string;
|
|
28
|
+
locale?: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).notFoundPage;
|
|
32
|
+
|
|
33
|
+
const { tagline, lede, homeHref, homeLabel, searchHref, searchLabel, searchAriaLabel, exploreLabel, exploreAriaLabel = defaultLabels.exploreAriaLabel, searchShortcut = defaultLabels.searchShortcut, links, searchBoxClass = 'group flex items-center gap-3 w-full max-w-sm mx-auto px-4 py-3 rounded-xl border border-foreground/20 bg-white/60 backdrop-blur-sm text-left hover:border-primary/40 hover:bg-white/80 transition-all no-underline' } = Astro.props;
|
|
31
34
|
---
|
|
32
35
|
|
|
33
36
|
<main class="relative min-h-[80vh] flex items-center justify-center overflow-hidden bg-muted">
|
|
@@ -9,7 +9,7 @@ import type { PersonLink } from '@sarimarcus/content-sites-core/people';
|
|
|
9
9
|
import { groupByEra } from './chronology';
|
|
10
10
|
import LinkArrow from '../primitives/LinkArrow.astro';
|
|
11
11
|
import { slugify } from '@sarimarcus/content-sites-core/text';
|
|
12
|
-
import {
|
|
12
|
+
import { getLabels } from '../internal/labels';
|
|
13
13
|
|
|
14
14
|
type Person = Pick<PersonLink, 'name' | 'href' | 'dates'>;
|
|
15
15
|
|
|
@@ -28,6 +28,7 @@ interface Props {
|
|
|
28
28
|
max?: number;
|
|
29
29
|
allLabel?: string;
|
|
30
30
|
allHref: string;
|
|
31
|
+
locale?: string;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
const {
|
|
@@ -39,8 +40,9 @@ const {
|
|
|
39
40
|
heading,
|
|
40
41
|
intro,
|
|
41
42
|
max = 8,
|
|
42
|
-
allLabel =
|
|
43
|
+
allLabel = getLabels(Astro.props.locale ?? Astro.currentLocale).peopleBand.allLabel,
|
|
43
44
|
allHref,
|
|
45
|
+
locale,
|
|
44
46
|
} = Astro.props;
|
|
45
47
|
let people: readonly Person[];
|
|
46
48
|
if (given) {
|
|
@@ -70,7 +72,7 @@ const headingId = `people-band-${slugify(heading)}`;
|
|
|
70
72
|
</div>
|
|
71
73
|
<ul class="mt-5 flex flex-wrap gap-2">
|
|
72
74
|
{people.map((p) => (
|
|
73
|
-
<li><PersonChip name={p.name} href={p.href} dates={p.dates} /></li>
|
|
75
|
+
<li><PersonChip name={p.name} href={p.href} dates={p.dates} locale={locale} /></li>
|
|
74
76
|
))}
|
|
75
77
|
</ul>
|
|
76
78
|
<p class="mt-5"><LinkArrow href={allHref}>{allLabel}</LinkArrow></p>
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
/** PeopleChips — "People in this story" chip list. The site resolves the people; nothing renders without any. */
|
|
3
3
|
import PersonChip from './PersonChip.astro';
|
|
4
4
|
import type { PersonLink } from '@sarimarcus/content-sites-core/people';
|
|
5
|
-
import {
|
|
5
|
+
import { getLabels } from '../internal/labels';
|
|
6
6
|
|
|
7
7
|
type Person = Pick<PersonLink, 'name' | 'href' | 'dates'>;
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
people?: readonly Person[];
|
|
11
11
|
heading?: string;
|
|
12
|
+
locale?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const { people = [], heading =
|
|
15
|
+
const { people = [], heading = getLabels(Astro.props.locale ?? Astro.currentLocale).peopleChips.heading, locale } = Astro.props;
|
|
15
16
|
---
|
|
16
17
|
|
|
17
18
|
{people.length > 0 && (
|
|
@@ -19,7 +20,7 @@ const { people = [], heading = LABELS.peopleChips.heading } = Astro.props;
|
|
|
19
20
|
<h2 id="people-chips-heading" class="mb-3 text-sm font-semibold uppercase tracking-wide text-muted-foreground">{heading}</h2>
|
|
20
21
|
<ul class="flex flex-wrap gap-2">
|
|
21
22
|
{people.map((p) => (
|
|
22
|
-
<li><PersonChip name={p.name} href={p.href} dates={p.dates} /></li>
|
|
23
|
+
<li><PersonChip name={p.name} href={p.href} dates={p.dates} locale={locale} /></li>
|
|
23
24
|
))}
|
|
24
25
|
</ul>
|
|
25
26
|
</section>
|
|
@@ -12,7 +12,7 @@ import Container from '../layout/Container.astro';
|
|
|
12
12
|
import LinkArrow from '../primitives/LinkArrow.astro';
|
|
13
13
|
import PersonCard from './PersonCard.astro';
|
|
14
14
|
import PeopleTimeline from './PeopleTimeline.astro';
|
|
15
|
-
import {
|
|
15
|
+
import { getLabels } from '../internal/labels';
|
|
16
16
|
import { textAsHtml, type TrustedHtml } from '../types';
|
|
17
17
|
import { footstepLinks, layoutPeopleTimeline, type PeopleTimelineEntry } from './people-timeline';
|
|
18
18
|
|
|
@@ -43,8 +43,11 @@ interface Props {
|
|
|
43
43
|
timelineLabel?: string;
|
|
44
44
|
footstepsHeading?: string;
|
|
45
45
|
placesHeading?: string;
|
|
46
|
+
locale?: string;
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).peopleHub;
|
|
50
|
+
|
|
48
51
|
const {
|
|
49
52
|
title,
|
|
50
53
|
lede,
|
|
@@ -54,10 +57,11 @@ const {
|
|
|
54
57
|
people,
|
|
55
58
|
eraNotes = {},
|
|
56
59
|
eraNotesHtml = {},
|
|
57
|
-
indexLabel =
|
|
60
|
+
indexLabel = defaultLabels.indexLabel,
|
|
58
61
|
timelineLabel,
|
|
59
|
-
footstepsHeading =
|
|
60
|
-
placesHeading =
|
|
62
|
+
footstepsHeading = defaultLabels.footstepsHeading,
|
|
63
|
+
placesHeading = defaultLabels.placesHeading,
|
|
64
|
+
locale,
|
|
61
65
|
} = Astro.props;
|
|
62
66
|
|
|
63
67
|
const introParagraphs = introHtml ?? intro.map(textAsHtml);
|
|
@@ -85,8 +89,9 @@ const withPlaces = segments.flatMap((s) => s.dots).filter((p): p is typeof p & {
|
|
|
85
89
|
items={sections.map(({ era, group }) => ({ label: `${era.label} (${group.length})`, href: `#era-${era.id}` }))}
|
|
86
90
|
sectionSelector="[data-people-era]"
|
|
87
91
|
hideMiniPastLastSection
|
|
92
|
+
locale={locale}
|
|
88
93
|
/>
|
|
89
|
-
<PeopleTimeline class="mb-14" segments={segments} ariaLabel={timelineLabel} />
|
|
94
|
+
<PeopleTimeline class="mb-14" segments={segments} ariaLabel={timelineLabel} locale={locale} />
|
|
90
95
|
{sections.map(({ era, group }) => (
|
|
91
96
|
<section id={`era-${era.id}`} class="mb-14 scroll-mt-28" aria-labelledby={`era-${era.id}-heading`} data-people-era>
|
|
92
97
|
<h2 id={`era-${era.id}-heading`} class="font-display text-2xl font-semibold text-foreground">{era.label}</h2>
|
|
@@ -104,6 +109,7 @@ const withPlaces = segments.flatMap((s) => s.dots).filter((p): p is typeof p & {
|
|
|
104
109
|
roles={p.roles}
|
|
105
110
|
knownFor={p.knownFor}
|
|
106
111
|
eraLabel={`${era.label} · ${era.rangeLabel}`}
|
|
112
|
+
locale={locale}
|
|
107
113
|
/>
|
|
108
114
|
))}
|
|
109
115
|
</div>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* link to `#<sectionIdPrefix><era.id>`. Hidden below md: the hub's era index takes over there.
|
|
6
6
|
*/
|
|
7
7
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
8
|
-
import {
|
|
8
|
+
import { getLabels } from '../internal/labels';
|
|
9
9
|
import { layoutPeopleTimeline, type PeopleTimelineEntry, type PeopleTimelineSegment } from './people-timeline';
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
@@ -17,16 +17,19 @@ interface Props {
|
|
|
17
17
|
/** Fragment prefix of the era sections the labels link to. */
|
|
18
18
|
sectionIdPrefix?: string;
|
|
19
19
|
approximateLabel?: string;
|
|
20
|
+
locale?: string;
|
|
20
21
|
class?: string;
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).peopleTimeline;
|
|
25
|
+
|
|
23
26
|
const {
|
|
24
27
|
eras = [],
|
|
25
28
|
people = [],
|
|
26
29
|
segments: laidOut,
|
|
27
|
-
ariaLabel =
|
|
30
|
+
ariaLabel = defaultLabels.ariaLabel,
|
|
28
31
|
sectionIdPrefix = 'era-',
|
|
29
|
-
approximateLabel =
|
|
32
|
+
approximateLabel = defaultLabels.approximate,
|
|
30
33
|
class: className,
|
|
31
34
|
} = Astro.props;
|
|
32
35
|
|
|
@@ -45,7 +48,7 @@ const segments = laidOut ?? layoutPeopleTimeline(eras, people);
|
|
|
45
48
|
<div class="relative mx-2 mt-3 h-6">
|
|
46
49
|
<span class="absolute inset-x-0 top-1/2 h-0.5 -translate-y-1/2 bg-foreground/15" aria-hidden="true"></span>
|
|
47
50
|
{dots.map((dot) => {
|
|
48
|
-
const label =
|
|
51
|
+
const label = defaultLabels.dotLabel(dot.name, dot.dates);
|
|
49
52
|
const full = dot.approximate ? `${label} (${approximateLabel})` : label;
|
|
50
53
|
return (
|
|
51
54
|
<a
|
|
@@ -12,7 +12,7 @@ import ArrowLabel from '../primitives/ArrowLabel.astro';
|
|
|
12
12
|
import Badge from '../primitives/Badge.astro';
|
|
13
13
|
import { monogram as initialsOf } from './monogram';
|
|
14
14
|
import CardPlaceholder from './CardPlaceholder.astro';
|
|
15
|
-
import {
|
|
15
|
+
import { getLabels } from '../internal/labels';
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
18
|
href: string;
|
|
@@ -36,6 +36,7 @@ interface Props {
|
|
|
36
36
|
index?: number;
|
|
37
37
|
eager?: number;
|
|
38
38
|
sizes?: string;
|
|
39
|
+
locale?: string;
|
|
39
40
|
class?: string;
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -51,7 +52,7 @@ const {
|
|
|
51
52
|
eraLabel,
|
|
52
53
|
monogram,
|
|
53
54
|
description,
|
|
54
|
-
ctaLabel =
|
|
55
|
+
ctaLabel = getLabels(Astro.props.locale ?? Astro.currentLocale).personCard.cta,
|
|
55
56
|
headingLevel = 3,
|
|
56
57
|
index,
|
|
57
58
|
eager,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* a name or an href.
|
|
6
6
|
*/
|
|
7
7
|
import Chip from '../primitives/Chip.astro';
|
|
8
|
-
import {
|
|
8
|
+
import { getLabels } from '../internal/labels';
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
name?: string;
|
|
@@ -17,6 +17,7 @@ interface Props {
|
|
|
17
17
|
size?: 'sm' | 'md';
|
|
18
18
|
/** Set false to drop the visible life dates; they stay in the accessible name. */
|
|
19
19
|
showDates?: boolean;
|
|
20
|
+
locale?: string;
|
|
20
21
|
class?: string;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -24,7 +25,7 @@ const {
|
|
|
24
25
|
name,
|
|
25
26
|
href,
|
|
26
27
|
dates,
|
|
27
|
-
ariaLabel =
|
|
28
|
+
ariaLabel = getLabels(Astro.props.locale ?? Astro.currentLocale).personChip.ariaLabel,
|
|
28
29
|
icon = 'user',
|
|
29
30
|
size = 'md',
|
|
30
31
|
showDates = true,
|
|
@@ -38,7 +38,7 @@ import { monogram as initialsOf } from './monogram';
|
|
|
38
38
|
import PersonSection from './PersonSection.astro';
|
|
39
39
|
import CardPlaceholder from './CardPlaceholder.astro';
|
|
40
40
|
import QuickFacts from '../composed/QuickFacts.astro';
|
|
41
|
-
import {
|
|
41
|
+
import { getLabels } from '../internal/labels';
|
|
42
42
|
|
|
43
43
|
type PersonImage =
|
|
44
44
|
| { image?: undefined; fallbackSrc?: undefined; imageAlt?: string }
|
|
@@ -99,9 +99,12 @@ type Props = PersonImage & {
|
|
|
99
99
|
timeline?: { eras: readonly EraDefinition[]; items: Record<string, readonly TimelineItem[]>; heading?: string };
|
|
100
100
|
/** Overrides of the ToC pill labels. */
|
|
101
101
|
tocLabels?: Partial<Record<'biography' | 'places' | 'timeline' | 'readMore', string>>;
|
|
102
|
+
locale?: string;
|
|
102
103
|
pagefindType?: string;
|
|
103
104
|
};
|
|
104
105
|
|
|
106
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).personPage;
|
|
107
|
+
|
|
105
108
|
const {
|
|
106
109
|
name,
|
|
107
110
|
dates,
|
|
@@ -110,7 +113,7 @@ const {
|
|
|
110
113
|
circa = false,
|
|
111
114
|
lifespan,
|
|
112
115
|
aliases = [],
|
|
113
|
-
aliasesLabel =
|
|
116
|
+
aliasesLabel = defaultLabels.alsoKnownAs,
|
|
114
117
|
contextFact,
|
|
115
118
|
monogram,
|
|
116
119
|
roles = [],
|
|
@@ -122,26 +125,27 @@ const {
|
|
|
122
125
|
bioHtml,
|
|
123
126
|
proseClass = 'prose-lg',
|
|
124
127
|
fullStory,
|
|
125
|
-
fullStoryHeading =
|
|
128
|
+
fullStoryHeading = defaultLabels.fullStoryHeading,
|
|
126
129
|
places = [],
|
|
127
|
-
placesHeading =
|
|
130
|
+
placesHeading = defaultLabels.placesHeading,
|
|
128
131
|
readMore = [],
|
|
129
132
|
readMoreLimit = 4,
|
|
130
|
-
readMoreHeading =
|
|
133
|
+
readMoreHeading = defaultLabels.readMoreHeading,
|
|
131
134
|
timeline,
|
|
132
135
|
tocLabels,
|
|
136
|
+
locale,
|
|
133
137
|
pagefindType = 'person',
|
|
134
138
|
} = Astro.props;
|
|
135
139
|
|
|
136
|
-
const timelineHeading = timeline?.heading ??
|
|
140
|
+
const timelineHeading = timeline?.heading ?? defaultLabels.timelineHeading;
|
|
137
141
|
const hasTimeline = Boolean(timeline && Object.values(timeline.items).some((list) => list.length > 0));
|
|
138
142
|
const readMoreItems = readMore.slice(0, readMoreLimit);
|
|
139
143
|
|
|
140
144
|
const span = lifeSpan({ birthYear, deathYear });
|
|
141
145
|
const lifespanByKind = {
|
|
142
|
-
range: () =>
|
|
143
|
-
born: () =>
|
|
144
|
-
died: () =>
|
|
146
|
+
range: () => defaultLabels.lifespan(span.years ?? '', circa, span.age),
|
|
147
|
+
born: () => defaultLabels.born(span.years ?? '', circa),
|
|
148
|
+
died: () => defaultLabels.died(span.years ?? '', circa),
|
|
145
149
|
none: () => undefined,
|
|
146
150
|
};
|
|
147
151
|
const derivedLifespan = lifespanByKind[span.kind]();
|
|
@@ -155,10 +159,10 @@ const facts = [
|
|
|
155
159
|
const hasFullStoryCard = Boolean(fullStory?.title);
|
|
156
160
|
const bioParagraphs = (String(bioHtml).match(/<p[\s>]/g) ?? []).length;
|
|
157
161
|
const toc = {
|
|
158
|
-
biography: tocLabels?.biography ??
|
|
159
|
-
places: tocLabels?.places ??
|
|
160
|
-
timeline: tocLabels?.timeline ??
|
|
161
|
-
readMore: tocLabels?.readMore ??
|
|
162
|
+
biography: tocLabels?.biography ?? defaultLabels.tocLabels.biography,
|
|
163
|
+
places: tocLabels?.places ?? defaultLabels.tocLabels.places,
|
|
164
|
+
timeline: tocLabels?.timeline ?? defaultLabels.tocLabels.timeline,
|
|
165
|
+
readMore: tocLabels?.readMore ?? defaultLabels.tocLabels.readMore,
|
|
162
166
|
};
|
|
163
167
|
const showToc = bioParagraphs > 4;
|
|
164
168
|
const tocItems = [
|
|
@@ -190,7 +194,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
190
194
|
{roles.map((role) => (
|
|
191
195
|
<RoleBadge onImage>{role}</RoleBadge>
|
|
192
196
|
))}
|
|
193
|
-
<EraChip era={era} basePath={eraBasePath} onImage />
|
|
197
|
+
<EraChip era={era} basePath={eraBasePath} onImage locale={locale} />
|
|
194
198
|
</Fragment>
|
|
195
199
|
<Fragment slot="subtitle">
|
|
196
200
|
{lifespanText && (
|
|
@@ -211,6 +215,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
211
215
|
items={tocItems}
|
|
212
216
|
sectionSelector="[data-person-section]"
|
|
213
217
|
hideMiniPastLastSection
|
|
218
|
+
locale={locale}
|
|
214
219
|
/>
|
|
215
220
|
)}
|
|
216
221
|
|
|
@@ -226,7 +231,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
226
231
|
|
|
227
232
|
{fullStory && !hasFullStoryCard && (
|
|
228
233
|
<p class="mt-6">
|
|
229
|
-
<LinkArrow href={fullStory.href} size="base">{fullStory.label ??
|
|
234
|
+
<LinkArrow href={fullStory.href} size="base">{fullStory.label ?? defaultLabels.readFullStory}</LinkArrow>
|
|
230
235
|
</p>
|
|
231
236
|
)}
|
|
232
237
|
|
|
@@ -245,7 +250,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
245
250
|
<CardPlaceholder slot="fallback"><Icon name="book-open" class="size-10 text-primary/70" /></CardPlaceholder>
|
|
246
251
|
<h3 class="text-xl font-display font-semibold text-foreground">{fullStory.title}</h3>
|
|
247
252
|
{fullStory.summary && <p class="mt-2 text-sm leading-relaxed text-muted-foreground">{fullStory.summary}</p>}
|
|
248
|
-
<ArrowLabel slot="footer-cta" class="text-sm font-medium text-primary">{fullStory.label ??
|
|
253
|
+
<ArrowLabel slot="footer-cta" class="text-sm font-medium text-primary">{fullStory.label ?? defaultLabels.readFullStory}</ArrowLabel>
|
|
249
254
|
</EntityCard>
|
|
250
255
|
</div>
|
|
251
256
|
</PersonSection>
|
|
@@ -262,7 +267,7 @@ const heroMonogram = image || fallbackSrc ? undefined : (monogram ?? initialsOf(
|
|
|
262
267
|
{timeline && hasTimeline && (
|
|
263
268
|
<Container size="content" class="mt-16">
|
|
264
269
|
<PersonSection section="timeline" heading={timelineHeading} headingClass="mb-8">
|
|
265
|
-
<ChronologyTimeline eras={timeline.eras} items={timeline.items} index={false} />
|
|
270
|
+
<ChronologyTimeline eras={timeline.eras} items={timeline.items} index={false} locale={locale} />
|
|
266
271
|
</PersonSection>
|
|
267
272
|
</Container>
|
|
268
273
|
)}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* default top margin (`mt-12`); `labelClass` sets the slot label size.
|
|
5
5
|
*/
|
|
6
6
|
import Icon from '../primitives/Icon.astro';
|
|
7
|
-
import {
|
|
7
|
+
import { getLabels } from '../internal/labels';
|
|
8
8
|
|
|
9
9
|
export interface VisitTimingData {
|
|
10
10
|
bestSeason?: string;
|
|
@@ -20,17 +20,20 @@ interface Props {
|
|
|
20
20
|
id?: string;
|
|
21
21
|
class?: string;
|
|
22
22
|
labelClass?: string;
|
|
23
|
+
locale?: string;
|
|
23
24
|
/** Row labels; default English. */
|
|
24
25
|
labels?: { bestSeason: string; quietestHours: string; visitDuration: string };
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).visitTiming;
|
|
29
|
+
|
|
27
30
|
const {
|
|
28
31
|
visitTiming,
|
|
29
|
-
title =
|
|
32
|
+
title = defaultLabels.title,
|
|
30
33
|
id = 'when-to-visit',
|
|
31
34
|
class: className = 'mt-12',
|
|
32
35
|
labelClass = 'text-[0.8125rem]',
|
|
33
|
-
labels =
|
|
36
|
+
labels = defaultLabels,
|
|
34
37
|
} = Astro.props;
|
|
35
38
|
|
|
36
39
|
const slots = visitTiming
|