@sarimarcus/content-sites-ui 0.54.1 → 0.54.2
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 +4 -0
- 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/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/chronology-page.ts +4 -2
- package/src/editorial/era-listing.ts +3 -2
- package/src/editorial/eventEdition.ts +3 -2
- package/src/editorial/person-page.ts +5 -3
- package/src/internal/labels.ts +194 -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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { formatUtcDate } from '@sarimarcus/content-sites-core/dates';
|
|
8
8
|
import { Icon, LinkArrow } from '../primitives/index.ts';
|
|
9
9
|
import type { TopicPagerLink } from './types';
|
|
10
|
-
import {
|
|
10
|
+
import { getLabels } from '../internal/labels';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
topic: { label: string; href: string; count?: number };
|
|
@@ -18,6 +18,8 @@ interface Props {
|
|
|
18
18
|
olderLabel?: string;
|
|
19
19
|
/** The topic hub link's text. */
|
|
20
20
|
allLabel?: string;
|
|
21
|
+
/** BCP-47 locale for date formatting and default labels (defaults to `en-GB`). */
|
|
22
|
+
locale?: string;
|
|
21
23
|
class?: string;
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -25,14 +27,15 @@ const {
|
|
|
25
27
|
topic,
|
|
26
28
|
newer,
|
|
27
29
|
older,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
|
|
31
|
+
heading = getLabels(locale).articleTopicPager.heading(topic.label),
|
|
32
|
+
newerLabel = getLabels(locale).articleTopicPager.newerLabel,
|
|
33
|
+
olderLabel = getLabels(locale).articleTopicPager.olderLabel,
|
|
34
|
+
allLabel = getLabels(locale).articleTopicPager.allLabel(topic.label, topic.count),
|
|
32
35
|
class: className,
|
|
33
36
|
} = Astro.props;
|
|
34
37
|
|
|
35
|
-
const day = (iso?: string) => formatUtcDate(iso, { day: 'numeric', month: 'short', year: 'numeric' },
|
|
38
|
+
const day = (iso?: string) => formatUtcDate(iso, { day: 'numeric', month: 'short', year: 'numeric' }, locale);
|
|
36
39
|
const sides = [
|
|
37
40
|
newer && { link: newer, label: newerLabel, dir: 'newer' as const },
|
|
38
41
|
older && { link: older, label: olderLabel, dir: 'older' as const },
|
|
@@ -8,7 +8,7 @@ import TableOfContents from '../composed/TableOfContents.astro';
|
|
|
8
8
|
import EraDossiers from './EraDossiers.astro';
|
|
9
9
|
import EraEntryRow from './EraEntryRow.astro';
|
|
10
10
|
import EraTimelineNav from './EraTimelineNav.astro';
|
|
11
|
-
import {
|
|
11
|
+
import { getLabels } from '../internal/labels';
|
|
12
12
|
import { orderEras, orphanEraIds, type TimelineItem } from './chronology';
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
@@ -25,19 +25,23 @@ interface Props {
|
|
|
25
25
|
emptyLabel?: string;
|
|
26
26
|
/** Heads the entries without a `yearLabel` when an era also has dated ones, which then render first (order kept within each run); '' keeps one run in the given order. */
|
|
27
27
|
undatedLabel?: string;
|
|
28
|
+
locale?: string;
|
|
28
29
|
class?: string;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).chronologyTimeline;
|
|
33
|
+
|
|
31
34
|
const {
|
|
32
35
|
eras,
|
|
33
36
|
items,
|
|
34
37
|
emptyEra = 'hide',
|
|
35
38
|
index = true,
|
|
36
39
|
indexStyle = 'chips',
|
|
37
|
-
indexLabel =
|
|
38
|
-
dossiersLabel =
|
|
39
|
-
emptyLabel =
|
|
40
|
-
undatedLabel =
|
|
40
|
+
indexLabel = defaultLabels.indexLabel,
|
|
41
|
+
dossiersLabel = defaultLabels.dossiersLabel,
|
|
42
|
+
emptyLabel = defaultLabels.emptyLabel,
|
|
43
|
+
undatedLabel = defaultLabels.undatedLabel,
|
|
44
|
+
locale,
|
|
41
45
|
class: className,
|
|
42
46
|
} = Astro.props;
|
|
43
47
|
|
|
@@ -61,7 +65,7 @@ if (import.meta.env.DEV) {
|
|
|
61
65
|
---
|
|
62
66
|
|
|
63
67
|
<div class:list={['w-full', className]} data-chronology>
|
|
64
|
-
{index && fullEras.length > 1 && indexStyle === 'timeline' && <EraTimelineNav eras={fullEras} ariaLabel={indexLabel} />}{index && fullEras.length > 1 && (
|
|
68
|
+
{index && fullEras.length > 1 && indexStyle === 'timeline' && <EraTimelineNav eras={fullEras} ariaLabel={indexLabel} locale={locale} />}{index && fullEras.length > 1 && (
|
|
65
69
|
<TableOfContents
|
|
66
70
|
class:list={['mb-12 md:mb-16', indexStyle === 'timeline' && 'md:hidden']}
|
|
67
71
|
showHeader={false}
|
|
@@ -69,6 +73,7 @@ if (import.meta.env.DEV) {
|
|
|
69
73
|
items={fullEras.map((era) => ({ label: era.label, href: `#${era.anchor}` }))}
|
|
70
74
|
sectionSelector="[data-chronology-era]"
|
|
71
75
|
hideMiniPastLastSection
|
|
76
|
+
locale={locale}
|
|
72
77
|
/>
|
|
73
78
|
)}
|
|
74
79
|
<ol class="grid">
|
|
@@ -89,7 +94,7 @@ if (import.meta.env.DEV) {
|
|
|
89
94
|
</ol>
|
|
90
95
|
</>
|
|
91
96
|
))}
|
|
92
|
-
<EraDossiers era={era} label={dossiersLabel} />
|
|
97
|
+
<EraDossiers era={era} label={dossiersLabel} locale={locale} />
|
|
93
98
|
</div>
|
|
94
99
|
</li>
|
|
95
100
|
) : (
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import RelatedContent from '../composed/RelatedContent.astro';
|
|
11
11
|
import ArrowLabel from '../primitives/ArrowLabel.astro';
|
|
12
12
|
import SectionDivider from '../primitives/SectionDivider.astro';
|
|
13
|
-
import {
|
|
13
|
+
import { getLabels } from '../internal/labels';
|
|
14
14
|
import { DOSSIER_MAX_RUN, chunk, dossierCards, groupDossier, type DossierEntry } from './dossier';
|
|
15
15
|
|
|
16
16
|
interface Props {
|
|
@@ -24,8 +24,11 @@ interface Props {
|
|
|
24
24
|
viewAllLabel?: string;
|
|
25
25
|
themeLabels?: Record<string, string>;
|
|
26
26
|
fallbackTitle?: string;
|
|
27
|
+
locale?: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).dossierSection;
|
|
31
|
+
|
|
29
32
|
const {
|
|
30
33
|
cluster,
|
|
31
34
|
title,
|
|
@@ -33,9 +36,9 @@ const {
|
|
|
33
36
|
layout = 'cards',
|
|
34
37
|
columns = layout === 'chunked' ? 3 : 2,
|
|
35
38
|
viewAllHref,
|
|
36
|
-
viewAllLabel =
|
|
37
|
-
themeLabels =
|
|
38
|
-
fallbackTitle =
|
|
39
|
+
viewAllLabel = defaultLabels.viewAllLabel,
|
|
40
|
+
themeLabels = defaultLabels.themeLabels,
|
|
41
|
+
fallbackTitle = defaultLabels.fallbackTitle,
|
|
39
42
|
} = Astro.props;
|
|
40
43
|
|
|
41
44
|
if (items.length === 0) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
8
8
|
import { eraHref } from '@sarimarcus/content-sites-core/eras';
|
|
9
9
|
import Chip from '../primitives/Chip.astro';
|
|
10
|
-
import {
|
|
10
|
+
import { getLabels } from '../internal/labels';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
era?: EraDefinition;
|
|
@@ -18,13 +18,16 @@ interface Props {
|
|
|
18
18
|
/** Opaque scrim tone for a chip laid over a photo or the hero overlay. */
|
|
19
19
|
onImage?: boolean;
|
|
20
20
|
size?: 'sm' | 'md';
|
|
21
|
+
locale?: string;
|
|
21
22
|
class?: string;
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).eraChip;
|
|
26
|
+
|
|
24
27
|
const {
|
|
25
28
|
era,
|
|
26
29
|
basePath,
|
|
27
|
-
ariaLabel = (e: EraDefinition) =>
|
|
30
|
+
ariaLabel = (e: EraDefinition) => defaultLabels.ariaLabel(e.label, e.rangeLabel),
|
|
28
31
|
icon = 'history',
|
|
29
32
|
onImage = false,
|
|
30
33
|
size = 'md',
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
/** The "go deeper" links under an era; renders nothing without dossiers. */
|
|
3
3
|
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
4
4
|
import LinkArrow from '../primitives/LinkArrow.astro';
|
|
5
|
-
import {
|
|
5
|
+
import { getLabels } from '../internal/labels';
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
era: EraDefinition;
|
|
9
9
|
label?: string;
|
|
10
|
+
locale?: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
const { era, label =
|
|
13
|
+
const { era, label = getLabels(Astro.props.locale ?? Astro.currentLocale).chronologyTimeline.dossiersLabel } = Astro.props;
|
|
13
14
|
---
|
|
14
15
|
|
|
15
16
|
{era.dossiers && era.dossiers.length > 0 && (
|
|
@@ -9,7 +9,7 @@ import type { PersonLink } from '@sarimarcus/content-sites-core/people';
|
|
|
9
9
|
import EraChip from './EraChip.astro';
|
|
10
10
|
import PersonChip from './PersonChip.astro';
|
|
11
11
|
import { PILL_BASE } from '../primitives/pillRecipe';
|
|
12
|
-
import {
|
|
12
|
+
import { getLabels } from '../internal/labels';
|
|
13
13
|
|
|
14
14
|
type Person = Pick<PersonLink, 'name' | 'href' | 'dates'>;
|
|
15
15
|
|
|
@@ -19,27 +19,31 @@ interface Props {
|
|
|
19
19
|
people?: readonly Person[];
|
|
20
20
|
visible?: number;
|
|
21
21
|
label?: string;
|
|
22
|
+
locale?: string;
|
|
22
23
|
class?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).eraPeopleRow;
|
|
27
|
+
|
|
25
28
|
const {
|
|
26
29
|
era,
|
|
27
30
|
eraBasePath,
|
|
28
31
|
people = [],
|
|
29
32
|
visible = 3,
|
|
30
|
-
label =
|
|
33
|
+
label = defaultLabels.peopleLabel,
|
|
34
|
+
locale,
|
|
31
35
|
class: className,
|
|
32
36
|
}: Props = Astro.props;
|
|
33
37
|
const valid = people.filter((p) => p.name && p.href);
|
|
34
38
|
const shown = valid.slice(0, visible);
|
|
35
39
|
const rest = valid.slice(visible);
|
|
36
40
|
const hit = "relative before:absolute before:inset-x-0 before:-inset-y-2 before:content-['']";
|
|
37
|
-
const chip = (p: Person) => ({ name: p.name, href: p.href, dates: p.dates, size: 'sm' as const, showDates: false, class: hit });
|
|
41
|
+
const chip = (p: Person) => ({ name: p.name, href: p.href, dates: p.dates, size: 'sm' as const, showDates: false, locale, class: hit });
|
|
38
42
|
---
|
|
39
43
|
|
|
40
44
|
{(era || valid.length > 0) && (
|
|
41
45
|
<div class:list={['flex flex-wrap items-center gap-x-2 gap-y-3', className]} data-era-people-row>
|
|
42
|
-
{era ? <EraChip era={era} basePath={eraBasePath} size="sm" class={hit} /> : (
|
|
46
|
+
{era ? <EraChip era={era} basePath={eraBasePath} size="sm" locale={locale} class={hit} /> : (
|
|
43
47
|
<span class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{label}</span>
|
|
44
48
|
)}
|
|
45
49
|
{valid.length > 0 && (
|
|
@@ -51,8 +55,8 @@ const chip = (p: Person) => ({ name: p.name, href: p.href, dates: p.dates, size:
|
|
|
51
55
|
class:list={[PILL_BASE, hit, 'cursor-pointer border border-border px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-primary']}
|
|
52
56
|
>
|
|
53
57
|
<input type="checkbox" class="sr-only" />
|
|
54
|
-
<span class="group-has-[:checked]/people:hidden">{
|
|
55
|
-
<span class="hidden group-has-[:checked]/people:inline">{
|
|
58
|
+
<span class="group-has-[:checked]/people:hidden">{defaultLabels.more(rest.length)}<span class="sr-only">{defaultLabels.moreSr}</span></span>
|
|
59
|
+
<span class="hidden group-has-[:checked]/people:inline">{defaultLabels.fewer}</span>
|
|
56
60
|
</label>
|
|
57
61
|
</li>
|
|
58
62
|
)}
|
|
@@ -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,
|