@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.
Files changed (61) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +5 -1
  3. package/package.json +2 -2
  4. package/src/affiliate/AffiliateCard.astro +10 -8
  5. package/src/affiliate/AffiliateCardSection.astro +5 -2
  6. package/src/affiliate/AffiliateCarousel.astro +6 -2
  7. package/src/affiliate/AffiliateComparisonTable.astro +14 -11
  8. package/src/affiliate/AmazonProductCard.astro +3 -2
  9. package/src/affiliate/AmazonProductSection.astro +5 -3
  10. package/src/affiliate/HotelAffiliateCTA.astro +15 -12
  11. package/src/affiliate/InlineAffiliateCTA.astro +3 -2
  12. package/src/affiliate/StickyCTA.astro +7 -4
  13. package/src/affiliate/TravelpayoutsWidget.astro +3 -2
  14. package/src/affiliate/cardItem.ts +1 -1
  15. package/src/composed/CardCarousel.astro +8 -5
  16. package/src/composed/FAQ.astro +3 -2
  17. package/src/composed/Pagination.astro +9 -6
  18. package/src/composed/TableOfContents.astro +7 -4
  19. package/src/editorial/AlsoExplore.astro +3 -2
  20. package/src/editorial/ArticleCategoryNav.astro +6 -3
  21. package/src/editorial/ArticleFeatureCard.astro +5 -2
  22. package/src/editorial/ArticleTopicPager.astro +9 -6
  23. package/src/editorial/AuthorPage.astro +292 -0
  24. package/src/editorial/AuthorsIndexPage.astro +127 -0
  25. package/src/editorial/ChronologyTimeline.astro +12 -7
  26. package/src/editorial/DossierSection.astro +7 -4
  27. package/src/editorial/EraChip.astro +5 -2
  28. package/src/editorial/EraDossiers.astro +3 -2
  29. package/src/editorial/EraPeopleRow.astro +10 -6
  30. package/src/editorial/EraScenes.astro +9 -6
  31. package/src/editorial/EraTimelineNav.astro +3 -2
  32. package/src/editorial/EventEditionBadge.astro +6 -4
  33. package/src/editorial/EventEditionBanner.astro +8 -5
  34. package/src/editorial/EventPage.astro +1 -1
  35. package/src/editorial/NotFoundPage.astro +5 -2
  36. package/src/editorial/PeopleBand.astro +5 -3
  37. package/src/editorial/PeopleChips.astro +4 -3
  38. package/src/editorial/PeopleHub.astro +11 -5
  39. package/src/editorial/PeopleTimeline.astro +7 -4
  40. package/src/editorial/PersonCard.astro +3 -2
  41. package/src/editorial/PersonChip.astro +3 -2
  42. package/src/editorial/PersonPage.astro +22 -17
  43. package/src/editorial/VisitTiming.astro +6 -3
  44. package/src/editorial/author-page.ts +113 -0
  45. package/src/editorial/chronology-page.ts +4 -2
  46. package/src/editorial/era-listing.ts +3 -2
  47. package/src/editorial/eventEdition.ts +3 -2
  48. package/src/editorial/index.ts +11 -0
  49. package/src/editorial/person-page.ts +5 -3
  50. package/src/internal/labels.ts +238 -0
  51. package/src/layout/DocumentShell.astro +7 -2
  52. package/src/navigation/ArticlesNavMenu.astro +4 -3
  53. package/src/navigation/SiteFooter.astro +7 -4
  54. package/src/navigation/SiteHeader.astro +7 -4
  55. package/src/navigation/types.ts +2 -0
  56. package/src/seo/ArticleMetadata.astro +9 -7
  57. package/src/seo/AuthoritativeSources.astro +20 -12
  58. package/src/seo/Breadcrumb.astro +6 -3
  59. package/src/seo/schemaContext.ts +2 -1
  60. package/src/seo/sourceLabels.ts +1 -0
  61. package/src/seo/types.ts +1 -1
@@ -7,7 +7,7 @@ import type { ImageMetadata } from 'astro';
7
7
  import ArticleByline from './ArticleByline.astro';
8
8
  import Icon from '../primitives/Icon.astro';
9
9
  import ResponsivePicture from '../primitives/ResponsivePicture.astro';
10
- import { LABELS } from '../internal/labels';
10
+ import { getLabels } from '../internal/labels';
11
11
 
12
12
  interface Props {
13
13
  href: string;
@@ -30,10 +30,13 @@ interface Props {
30
30
  loading?: 'eager' | 'lazy';
31
31
  headingLevel?: 2 | 3;
32
32
  pagefindIgnore?: boolean;
33
+ locale?: string;
33
34
  class?: string;
34
35
  }
35
36
 
36
- const { href, title, description, author, label, image, imageAlt = '', dateTime, dateLabel, updated = false, readLabel = LABELS.articleFeatureCard.readLabel, updatedLabel = LABELS.articleFeatureCard.updatedLabel, readingLabel, loading = 'eager', headingLevel = 2, pagefindIgnore = false, class: className = 'mb-12' } = Astro.props;
37
+ const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale).articleFeatureCard;
38
+
39
+ const { href, title, description, author, label, image, imageAlt = '', dateTime, dateLabel, updated = false, readLabel = defaultLabels.readLabel, updatedLabel = defaultLabels.updatedLabel, readingLabel, loading = 'eager', headingLevel = 2, pagefindIgnore = false, class: className = 'mb-12' } = Astro.props;
37
40
  const Heading = `h${headingLevel}` as 'h2' | 'h3';
38
41
  ---
39
42
 
@@ -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 { LABELS } from '../internal/labels';
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
- heading = LABELS.articleTopicPager.heading(topic.label),
29
- newerLabel = LABELS.articleTopicPager.newerLabel,
30
- olderLabel = LABELS.articleTopicPager.olderLabel,
31
- allLabel = LABELS.articleTopicPager.allLabel(topic.label, topic.count),
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' }, 'en-GB');
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 },
@@ -0,0 +1,292 @@
1
+ ---
2
+ import type { ImageMetadata } from 'astro';
3
+ import Container from '../layout/Container.astro';
4
+ import BreadcrumbBand from '../layout/BreadcrumbBand.astro';
5
+ import ResponsiveImage from '../primitives/ResponsiveImage.astro';
6
+ import Chip from '../primitives/Chip.astro';
7
+ import RoleBadge from './RoleBadge.astro';
8
+ import Icon from '../primitives/Icon.astro';
9
+ import { getLabels } from '../internal/labels';
10
+ import { socialLinkLabel, type AuthorWorkItem, type AuthorTopicLink } from './author-page';
11
+
12
+ interface Props {
13
+ name: string;
14
+ role?: string;
15
+ roleClass?: string;
16
+ bio: string;
17
+ credentials?: string;
18
+ credentialsHeading?: string;
19
+ expertise?: string[];
20
+ expertiseLinks?: Record<string, string>;
21
+ expertiseFallbackHref?: string;
22
+ sameAs?: string[];
23
+ portrait?: ImageMetadata | string;
24
+ portraitAlt?: string;
25
+ statsLine?: string;
26
+ totalItems?: number;
27
+ topicCount?: number;
28
+ statsNoun?: { one: string; many: string };
29
+ workItems?: AuthorWorkItem[];
30
+ topicLinks?: AuthorTopicLink[];
31
+ initialWorkCount?: number;
32
+ workHeading?: string;
33
+ workSubtitle?: string;
34
+ showMoreLabel?: (remaining: number) => string;
35
+ topicsHeading?: string;
36
+ emptyHeading?: string;
37
+ emptyBody?: string;
38
+ locale?: string;
39
+ }
40
+
41
+ const {
42
+ name,
43
+ role,
44
+ roleClass = 'text-sm font-semibold uppercase tracking-[0.18em] text-primary mb-3',
45
+ bio,
46
+ credentials,
47
+ credentialsHeading,
48
+ expertise = [],
49
+ expertiseLinks,
50
+ expertiseFallbackHref,
51
+ sameAs = [],
52
+ portrait,
53
+ portraitAlt,
54
+ statsLine,
55
+ totalItems = 0,
56
+ topicCount = 0,
57
+ statsNoun,
58
+ workItems = [],
59
+ topicLinks = [],
60
+ initialWorkCount = 24,
61
+ workHeading,
62
+ workSubtitle,
63
+ showMoreLabel,
64
+ topicsHeading,
65
+ emptyHeading,
66
+ emptyBody,
67
+ locale,
68
+ } = Astro.props;
69
+
70
+ const d = getLabels(locale).authorPage;
71
+ const resolvedRole = role ?? d.roleEyebrow;
72
+ const resolvedPortraitAlt = portraitAlt ?? d.portraitAlt(name);
73
+ const resolvedCredentialsHeading = credentialsHeading ?? d.credentialsHeading;
74
+ const resolvedStatsLine =
75
+ statsLine ?? (totalItems > 0 ? d.statsLine(totalItems, topicCount, statsNoun) : undefined);
76
+ const effectiveTotal = totalItems > 0 ? totalItems : workItems.length;
77
+ const resolvedWorkHeading = workHeading ?? d.workHeading;
78
+ const resolvedWorkSubtitle = workSubtitle ?? d.workSubtitle(effectiveTotal);
79
+ const resolvedShowMore = (showMoreLabel ?? d.showMore)(
80
+ Math.max(0, workItems.length - initialWorkCount),
81
+ );
82
+ const resolvedTopicsHeading = topicsHeading ?? d.topicsHeading;
83
+ const resolvedEmptyHeading = emptyHeading ?? d.emptyHeading;
84
+ const resolvedEmptyBody = emptyBody ?? d.emptyBody(name);
85
+ const hasExpertiseSlot = Astro.slots.has('expertise');
86
+ const hasWorksSlot = Astro.slots.has('works');
87
+ ---
88
+
89
+ <div class="bg-muted border-b border-border" data-pagefind-body>
90
+ <BreadcrumbBand ignore={false} class="pt-16">
91
+ <slot name="breadcrumb" />
92
+ </BreadcrumbBand>
93
+ <header class="pt-10 pb-12">
94
+ <Container>
95
+ <div
96
+ class:list={[
97
+ 'grid grid-cols-1 gap-8 items-start',
98
+ portrait && 'md:grid-cols-[200px_1fr] lg:grid-cols-[220px_1fr] lg:gap-12',
99
+ ]}
100
+ >
101
+ {portrait && (
102
+ <div class="w-40 sm:w-48 md:w-full">
103
+ <ResponsiveImage
104
+ src={portrait}
105
+ alt={resolvedPortraitAlt}
106
+ width={400}
107
+ height={400}
108
+ sizes="(min-width: 1024px) 220px, (min-width: 640px) 192px, 160px"
109
+ class="aspect-square w-full rounded-xl object-cover bg-muted"
110
+ loading="eager"
111
+ fetchpriority="high"
112
+ />
113
+ </div>
114
+ )}
115
+ <div>
116
+ <p class={roleClass}>
117
+ {resolvedRole}
118
+ </p>
119
+ <h1 class="text-4xl sm:text-5xl font-bold font-display text-foreground leading-tight">
120
+ {name}
121
+ </h1>
122
+ <div class="mt-4 flex">
123
+ <span class="block h-0.5 w-16 rounded-full bg-accent"></span>
124
+ </div>
125
+ <p class="mt-5 max-w-measure text-lg text-muted-foreground leading-relaxed">
126
+ {bio}
127
+ </p>
128
+
129
+ {credentials && (
130
+ <div class="mt-6 max-w-measure rounded-xl border border-border bg-card/70 p-4">
131
+ <p class="text-xs font-semibold uppercase tracking-[0.16em] text-primary mb-1.5">
132
+ {resolvedCredentialsHeading}
133
+ </p>
134
+ <p class="text-sm text-muted-foreground leading-relaxed">
135
+ {credentials}
136
+ </p>
137
+ </div>
138
+ )}
139
+
140
+ {hasExpertiseSlot ? (
141
+ <slot name="expertise" />
142
+ ) : (
143
+ expertise.length > 0 && (
144
+ <div class="mt-6 flex flex-wrap gap-2">
145
+ {expertise.map((topic) => {
146
+ const href = expertiseLinks?.[topic.toLowerCase()] ?? expertiseFallbackHref;
147
+ return href ? (
148
+ <Chip href={href} size="sm" text="sm" tone="outline">
149
+ {topic}
150
+ </Chip>
151
+ ) : (
152
+ <RoleBadge>{topic}</RoleBadge>
153
+ );
154
+ })}
155
+ </div>
156
+ )
157
+ )}
158
+
159
+ {sameAs.length > 0 && (
160
+ <div class="mt-6 flex flex-wrap items-center gap-3">
161
+ {sameAs.map((href) => (
162
+ <a
163
+ href={href}
164
+ target="_blank"
165
+ rel="noopener noreferrer"
166
+ class="inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary-strong transition-colors"
167
+ >
168
+ <span>{socialLinkLabel(href)}</span>
169
+ <Icon name="external-link" class="w-3.5 h-3.5" />
170
+ </a>
171
+ ))}
172
+ </div>
173
+ )}
174
+
175
+ {resolvedStatsLine && (
176
+ <p class="mt-6 text-sm text-muted-foreground">
177
+ {resolvedStatsLine}
178
+ </p>
179
+ )}
180
+ </div>
181
+ </div>
182
+ </Container>
183
+ </header>
184
+ </div>
185
+
186
+ <main class="py-12">
187
+ <Container>
188
+ {hasWorksSlot ? (
189
+ <slot name="works" />
190
+ ) : workItems.length > 0 ? (
191
+ <section data-author-work data-work-preview={initialWorkCount}>
192
+ <div class="mb-6">
193
+ <h2 class="text-2xl sm:text-3xl font-bold font-display text-foreground">
194
+ {resolvedWorkHeading}
195
+ </h2>
196
+ <p class="mt-1 text-sm text-muted-foreground">
197
+ {resolvedWorkSubtitle}
198
+ </p>
199
+ </div>
200
+
201
+ <ul class="divide-y divide-border rounded-xl border border-border bg-card overflow-hidden">
202
+ {workItems.map((item) => (
203
+ <li data-work-row>
204
+ <a
205
+ href={item.href}
206
+ class="group flex items-baseline justify-between gap-6 px-5 py-4 hover:bg-muted/40 transition-colors"
207
+ >
208
+ <div class="min-w-0 flex-1">
209
+ <div class="flex flex-wrap items-baseline gap-x-3 gap-y-1">
210
+ <h3 class="text-base sm:text-lg font-semibold font-display text-foreground group-hover:text-primary transition-colors">
211
+ {item.title}
212
+ </h3>
213
+ <span class="text-xs font-medium text-muted-foreground">
214
+ {item.kind}
215
+ </span>
216
+ </div>
217
+ {item.description && (
218
+ <p class="mt-1 text-sm text-muted-foreground line-clamp-1">
219
+ {item.description}
220
+ </p>
221
+ )}
222
+ </div>
223
+ <Icon
224
+ name="arrow-right"
225
+ class="w-4 h-4 shrink-0 text-muted-foreground group-hover:text-primary group-hover:translate-x-0.5 transition-all"
226
+ />
227
+ </a>
228
+ </li>
229
+ ))}
230
+ </ul>
231
+
232
+ {workItems.length > initialWorkCount && (
233
+ <div class="mt-6 text-center">
234
+ <Chip type="button" data-work-more tone="outline" size="md" class="px-5" hidden>
235
+ {resolvedShowMore}
236
+ </Chip>
237
+ </div>
238
+ )}
239
+
240
+ {topicLinks.length > 0 && (
241
+ <div class="mt-10">
242
+ <p class="text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground mb-3">
243
+ {resolvedTopicsHeading}
244
+ </p>
245
+ <div class="flex flex-wrap gap-2">
246
+ {topicLinks.map((g) => (
247
+ <Chip href={g.href} tone="outline" size="md">
248
+ {g.label}
249
+ </Chip>
250
+ ))}
251
+ </div>
252
+ </div>
253
+ )}
254
+ </section>
255
+ ) : (
256
+ <div class="text-center py-12 bg-muted/30 rounded-xl border border-border">
257
+ <p class="text-lg font-medium text-foreground mb-2">{resolvedEmptyHeading}</p>
258
+ <p class="text-muted-foreground">{resolvedEmptyBody}</p>
259
+ </div>
260
+ )}
261
+ </Container>
262
+ </main>
263
+
264
+ <script>
265
+ function initAuthorWork() {
266
+ document
267
+ .querySelectorAll<HTMLElement>('[data-author-work]:not([data-author-work-ready])')
268
+ .forEach((root) => {
269
+ root.setAttribute('data-author-work-ready', '');
270
+ const preview = Number(root.dataset.workPreview ?? 24);
271
+ const rows = root.querySelectorAll<HTMLElement>('[data-work-row]');
272
+ const more = root.querySelector<HTMLButtonElement>('[data-work-more]');
273
+ if (!more || rows.length <= preview) return;
274
+ rows.forEach((row, idx) => {
275
+ if (idx >= preview) row.hidden = true;
276
+ });
277
+ more.hidden = false;
278
+ more.addEventListener(
279
+ 'click',
280
+ () => {
281
+ rows.forEach((row) => {
282
+ row.hidden = false;
283
+ });
284
+ more.remove();
285
+ },
286
+ { once: true },
287
+ );
288
+ });
289
+ }
290
+ initAuthorWork();
291
+ document.addEventListener('astro:page-load', initAuthorWork);
292
+ </script>
@@ -0,0 +1,127 @@
1
+ ---
2
+ import Container from '../layout/Container.astro';
3
+ import BreadcrumbBand from '../layout/BreadcrumbBand.astro';
4
+ import Button from '../primitives/Button.astro';
5
+ import { getLabels } from '../internal/labels';
6
+
7
+ interface Props {
8
+ eyebrow?: string;
9
+ heading?: string;
10
+ lede: string;
11
+ contributorsCount: number;
12
+ contributorsLabel?: string;
13
+ entriesCount: number | string;
14
+ entriesLabel?: string;
15
+ closerHeading: string;
16
+ closerBody: string;
17
+ aboutHref: string;
18
+ aboutLabel?: string;
19
+ standardsHref: string;
20
+ standardsLabel?: string;
21
+ proseClass?: string;
22
+ locale?: string;
23
+ }
24
+
25
+ const {
26
+ eyebrow,
27
+ heading,
28
+ lede,
29
+ contributorsCount,
30
+ contributorsLabel,
31
+ entriesCount,
32
+ entriesLabel,
33
+ closerHeading,
34
+ closerBody,
35
+ aboutHref,
36
+ aboutLabel,
37
+ standardsHref,
38
+ standardsLabel,
39
+ proseClass = 'prose prose-stone max-w-none',
40
+ locale,
41
+ } = Astro.props;
42
+
43
+ const d = getLabels(locale).authorsIndexPage;
44
+ const resolvedEyebrow = eyebrow ?? d.eyebrow;
45
+ const resolvedHeading = heading ?? d.heading;
46
+ const resolvedContributorsLabel = contributorsLabel ?? d.contributorsLabel;
47
+ const resolvedEntriesLabel = entriesLabel ?? d.entriesLabel;
48
+ const resolvedAboutLabel = aboutLabel ?? d.aboutLabel;
49
+ const resolvedStandardsLabel = standardsLabel ?? d.standardsLabel;
50
+ const hasProse = Astro.slots.has('default');
51
+ const hasFaq = Astro.slots.has('faq');
52
+ ---
53
+
54
+ <div class="bg-muted border-b border-border" data-pagefind-body>
55
+ <BreadcrumbBand ignore={false} class="pt-16">
56
+ <slot name="breadcrumb" />
57
+ </BreadcrumbBand>
58
+ <header class="pt-12 pb-12">
59
+ <Container>
60
+ <p class="text-sm font-semibold uppercase tracking-[0.18em] text-primary mb-3">
61
+ {resolvedEyebrow}
62
+ </p>
63
+ <h1 class="text-4xl sm:text-5xl font-bold font-display text-foreground leading-tight">
64
+ {resolvedHeading}
65
+ </h1>
66
+ <div class="mt-4 flex">
67
+ <span class="block h-0.5 w-16 rounded-full bg-accent"></span>
68
+ </div>
69
+ <p class="mt-5 max-w-measure text-lg text-muted-foreground leading-relaxed">
70
+ {lede}
71
+ </p>
72
+
73
+ <div class="mt-8 flex flex-wrap gap-6 sm:gap-10">
74
+ <div>
75
+ <p class="text-2xl sm:text-3xl font-bold font-display text-foreground">
76
+ {contributorsCount}
77
+ </p>
78
+ <p class="text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground mt-0.5">
79
+ {resolvedContributorsLabel}
80
+ </p>
81
+ </div>
82
+ <div>
83
+ <p class="text-2xl sm:text-3xl font-bold font-display text-foreground">
84
+ {entriesCount}
85
+ </p>
86
+ <p class="text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground mt-0.5">
87
+ {resolvedEntriesLabel}
88
+ </p>
89
+ </div>
90
+ </div>
91
+ </Container>
92
+ </header>
93
+ </div>
94
+
95
+ <main class="py-12">
96
+ <Container size="measure">
97
+ {hasProse && (
98
+ <div class:list={[proseClass, 'mb-14']}>
99
+ <slot />
100
+ </div>
101
+ )}
102
+ <div class="mb-16">
103
+ <slot name="cards" />
104
+ </div>
105
+ {hasFaq && (
106
+ <div class="mb-16">
107
+ <slot name="faq" />
108
+ </div>
109
+ )}
110
+ <div class="rounded-2xl border border-border bg-muted/40 p-6 sm:p-8">
111
+ <h2 class="text-xl sm:text-2xl font-bold font-display text-foreground">
112
+ {closerHeading}
113
+ </h2>
114
+ <p class="mt-2 text-sm sm:text-base text-muted-foreground leading-relaxed">
115
+ {closerBody}
116
+ </p>
117
+ <div class="mt-4 flex flex-wrap gap-3">
118
+ <Button href={aboutHref} variant="secondary">
119
+ {resolvedAboutLabel}
120
+ </Button>
121
+ <Button href={standardsHref} variant="secondary">
122
+ {resolvedStandardsLabel}
123
+ </Button>
124
+ </div>
125
+ </div>
126
+ </Container>
127
+ </main>
@@ -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 { LABELS } from '../internal/labels';
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 = LABELS.chronologyTimeline.indexLabel,
38
- dossiersLabel = LABELS.chronologyTimeline.dossiersLabel,
39
- emptyLabel = LABELS.chronologyTimeline.emptyLabel,
40
- undatedLabel = LABELS.chronologyTimeline.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 { LABELS } from '../internal/labels';
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 = LABELS.dossierSection.viewAllLabel,
37
- themeLabels = LABELS.dossierSection.themeLabels,
38
- fallbackTitle = LABELS.dossierSection.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 { LABELS } from '../internal/labels';
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) => LABELS.eraChip.ariaLabel(e.label, e.rangeLabel),
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 { LABELS } from '../internal/labels';
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 = LABELS.chronologyTimeline.dossiersLabel } = Astro.props;
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 { LABELS } from '../internal/labels';
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 = LABELS.eraPeopleRow.peopleLabel,
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">{LABELS.eraPeopleRow.more(rest.length)}<span class="sr-only">{LABELS.eraPeopleRow.moreSr}</span></span>
55
- <span class="hidden group-has-[:checked]/people:inline">{LABELS.eraPeopleRow.fewer}</span>
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
  )}