@sarimarcus/content-sites-ui 0.47.0 → 0.48.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 +4 -0
- package/package.json +2 -2
- package/src/editorial/EventEditionBadge.astro +27 -0
- package/src/editorial/EventEditionBanner.astro +37 -0
- package/src/editorial/EventPage.astro +6 -0
- package/src/editorial/eventEdition.ts +35 -0
- package/src/editorial/index.ts +4 -0
- package/src/internal/labels.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.48.0 (2026-10-24)
|
|
6
|
+
|
|
7
|
+
- `editorial`: new `EventEditionBadge` and `EventEditionBanner`, and `EventPage` takes an optional `edition` (`{ startDate?, endDate?, eventsHref, eventsLabel? }`). An event whose last day (`endDate`, else `startDate`) is before today in Madrid gets a "Past edition · ended <date>" pill in the hero `badges` slot and, on `EventPage`, a short `data-edition-banner="past"` note above the body linking to the events hub. Undated, upcoming and running events render exactly what they did before (`render-diff` against 0.47.0: byte-identical); a site keeps its own "happening now" and "upcoming" pills. The copy defaults live in `LABELS.eventEdition` and each piece takes an override prop. Also exported: `eventEdition`, `eventEditionState`, `editionDateLabel`, `madridDay` (SLA-3435, epic SLA-3433).
|
|
8
|
+
|
|
5
9
|
## 0.47.0 (2026-10-23)
|
|
6
10
|
|
|
7
11
|
- `editorial`: `PeopleHub` people take optional `places` (`{ label, href }[]`); when any person has them, the closing block adds a "Where to find them" list (`LABELS.peopleHub.placesHeading`, prop `placesHeading`) linking each person to their places. Without `places` the markup is unchanged (SLA-3311).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Universal Astro UI components, layout shell and design tokens shared by the content sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"@lucide/astro": "^1.23.0",
|
|
51
51
|
"astro": "^7.0.6",
|
|
52
52
|
"tailwindcss": "^4.1.18",
|
|
53
|
-
"@sarimarcus/content-sites-core": "0.
|
|
53
|
+
"@sarimarcus/content-sites-core": "0.48.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
// EventEditionBadge: the hero pill of an event whose edition has ended (SLA-3435): "Past edition · ended <date>".
|
|
3
|
+
// It renders nothing for an undated, upcoming or running event, so a page that adds it changes only when its
|
|
4
|
+
// event is over. A site keeps its own "happening now" / "upcoming" pills.
|
|
5
|
+
import Badge from '../primitives/Badge.astro';
|
|
6
|
+
import { LABELS } from '../internal/labels';
|
|
7
|
+
import { editionDateLabel, eventEdition } from './eventEdition';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
startDate?: string;
|
|
11
|
+
endDate?: string;
|
|
12
|
+
/** The pill text for the day the edition ended; defaults to the English label. */
|
|
13
|
+
pastLabel?: (date: string) => string;
|
|
14
|
+
/** Pins today for tests; defaults to the Madrid day. */
|
|
15
|
+
today?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { startDate, endDate, pastLabel = LABELS.eventEdition.pastBadge, today } = Astro.props;
|
|
19
|
+
const { state, endDay } = eventEdition({ startDate, endDate }, today);
|
|
20
|
+
const label = state === 'past' ? pastLabel(editionDateLabel(endDay!)) : '';
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
{state === 'past' && (
|
|
24
|
+
<Badge tone="custom" toneClass="bg-muted text-muted-foreground" size="lg" lines={0} data-edition-state="past">
|
|
25
|
+
{label}
|
|
26
|
+
</Badge>
|
|
27
|
+
)}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
// EventEditionBanner: a short note above the body of a page about an event whose edition has ended (SLA-3435).
|
|
3
|
+
// It renders nothing for an undated, upcoming or running event. The page stays: it describes the last edition and
|
|
4
|
+
// points to the events hub for what is next. Gates key on `data-edition-banner`, never on its classes.
|
|
5
|
+
import { LABELS } from '../internal/labels';
|
|
6
|
+
import { editionDateLabel, eventEdition } from './eventEdition';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
startDate?: string;
|
|
10
|
+
endDate?: string;
|
|
11
|
+
/** The events hub, e.g. `url('/events')`. */
|
|
12
|
+
eventsHref: string;
|
|
13
|
+
eventsLabel?: string;
|
|
14
|
+
leadLabel?: (date: string) => string;
|
|
15
|
+
tailLabel?: string;
|
|
16
|
+
/** Pins today for tests; defaults to the Madrid day. */
|
|
17
|
+
today?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
startDate,
|
|
22
|
+
endDate,
|
|
23
|
+
eventsHref,
|
|
24
|
+
eventsLabel = LABELS.eventEdition.eventsLink,
|
|
25
|
+
leadLabel = LABELS.eventEdition.bannerLead,
|
|
26
|
+
tailLabel = LABELS.eventEdition.bannerTail,
|
|
27
|
+
today,
|
|
28
|
+
} = Astro.props;
|
|
29
|
+
const { state, endDay } = eventEdition({ startDate, endDate }, today);
|
|
30
|
+
const lead = state === 'past' ? leadLabel(editionDateLabel(endDay!)) : '';
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
{state === 'past' && (
|
|
34
|
+
<aside data-edition-banner="past" class="mb-8 rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm text-muted-foreground">
|
|
35
|
+
{lead} <a href={eventsHref} class="font-medium text-primary underline underline-offset-2">{eventsLabel}</a> {tailLabel}
|
|
36
|
+
</aside>
|
|
37
|
+
)}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import Container from '../layout/Container.astro';
|
|
20
20
|
import Badge from '../primitives/Badge.astro';
|
|
21
|
+
import EventEditionBanner from './EventEditionBanner.astro';
|
|
21
22
|
import AudienceFilters from '../layout/AudienceFilters.astro';
|
|
22
23
|
import BreadcrumbBand from '../layout/BreadcrumbBand.astro';
|
|
23
24
|
import { newTab } from '../primitives/newTab';
|
|
@@ -47,6 +48,8 @@ interface Props {
|
|
|
47
48
|
tags?: { heading: string; items: string[] };
|
|
48
49
|
pagefindType?: string;
|
|
49
50
|
audiences?: readonly string[];
|
|
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 };
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
const {
|
|
@@ -61,6 +64,7 @@ const {
|
|
|
61
64
|
tags,
|
|
62
65
|
pagefindType = 'event',
|
|
63
66
|
audiences = [],
|
|
67
|
+
edition,
|
|
64
68
|
} = Astro.props;
|
|
65
69
|
|
|
66
70
|
const toneText = { primary: 'text-primary', secondary: 'text-secondary', accent: 'text-accent' };
|
|
@@ -88,6 +92,8 @@ const withClass = (base: string, s?: Section) => (s?.class ? `${base} ${s.class}
|
|
|
88
92
|
{backLink.label}
|
|
89
93
|
</a>)}</slot>
|
|
90
94
|
|
|
95
|
+
{edition && <EventEditionBanner {...edition} />}
|
|
96
|
+
|
|
91
97
|
<slot name="before-body" /><slot name="body"><article id={article?.id} {...sectionAttr(article)} class={withClass(`prose ${proseClass} max-w-none`, article)} data-pagefind-body>
|
|
92
98
|
<div set:html={bodyHtml} />
|
|
93
99
|
</article></slot>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { formatUtcDate } from '@sarimarcus/content-sites-core/dates';
|
|
2
|
+
|
|
3
|
+
export type EventEditionState = 'now' | 'upcoming' | 'past';
|
|
4
|
+
|
|
5
|
+
/** A calendar day, `YYYY-MM-DD`. */
|
|
6
|
+
const DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
7
|
+
|
|
8
|
+
/** Today in Madrid, the day the sites are written against: a UTC day is a day off for 2 hours each night. */
|
|
9
|
+
export const madridDay = (now: Date = new Date()): string =>
|
|
10
|
+
new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Madrid' }).format(now);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Where an event's dated window sits against `today`, and the day it ended. Undated or malformed dates give
|
|
14
|
+
* `state: null`: a page without dates must render nothing new. `now` needs both dates (as the Córdoba pill
|
|
15
|
+
* always did); `past` is `endDate` (else `startDate`) before today, and `endDay` is that same validated day.
|
|
16
|
+
*/
|
|
17
|
+
export function eventEdition(
|
|
18
|
+
event: { startDate?: string; endDate?: string },
|
|
19
|
+
today: string = madridDay(),
|
|
20
|
+
): { state: EventEditionState | null; endDay: string | null } {
|
|
21
|
+
const { startDate, endDate } = event;
|
|
22
|
+
const start = startDate && DAY.test(startDate) ? startDate : undefined;
|
|
23
|
+
const end = endDate && DAY.test(endDate) ? endDate : undefined;
|
|
24
|
+
if (!start && !end) return { state: null, endDay: null };
|
|
25
|
+
const endDay = (end ?? start)!;
|
|
26
|
+
if (start && end && start <= today && today <= end) return { state: 'now', endDay };
|
|
27
|
+
if (start && start > today) return { state: 'upcoming', endDay };
|
|
28
|
+
return { state: endDay < today ? 'past' : null, endDay };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const eventEditionState = (event: { startDate?: string; endDate?: string }, today?: string): EventEditionState | null =>
|
|
32
|
+
eventEdition(event, today).state;
|
|
33
|
+
|
|
34
|
+
/** `2026-05-10` as `10 May 2026`, in the sites' English; '' for a malformed day. */
|
|
35
|
+
export const editionDateLabel = (day: string): string => formatUtcDate(day, { day: 'numeric', month: 'long', year: 'numeric' }, 'en-GB');
|
package/src/editorial/index.ts
CHANGED
|
@@ -4,6 +4,10 @@ export { default as EraScenes } from './EraScenes.astro';
|
|
|
4
4
|
export { splitScene } from './chronology';
|
|
5
5
|
export type { SceneItem, SceneKind, EraScene } from './chronology';
|
|
6
6
|
export { default as EventPage } from './EventPage.astro';
|
|
7
|
+
export { default as EventEditionBadge } from './EventEditionBadge.astro';
|
|
8
|
+
export { default as EventEditionBanner } from './EventEditionBanner.astro';
|
|
9
|
+
export { eventEdition, eventEditionState, editionDateLabel, madridDay } from './eventEdition';
|
|
10
|
+
export type { EventEditionState } from './eventEdition';
|
|
7
11
|
export { default as BeforeYouGo } from './BeforeYouGo.astro';
|
|
8
12
|
export { default as NumberedStep } from './NumberedStep.astro';
|
|
9
13
|
export { default as StaticProsePage } from './StaticProsePage.astro';
|
package/src/internal/labels.ts
CHANGED
|
@@ -28,6 +28,12 @@ export const LABELS = {
|
|
|
28
28
|
},
|
|
29
29
|
amazonProductCard: { ctaLabel: 'View on Amazon' },
|
|
30
30
|
amazonProductSection: { title: 'Recommended reading' },
|
|
31
|
+
eventEdition: {
|
|
32
|
+
pastBadge: (date: string) => `Past edition · ended ${date}`,
|
|
33
|
+
bannerLead: (date: string) => `This page describes the edition that ended on ${date}.`,
|
|
34
|
+
bannerTail: 'for what is next.',
|
|
35
|
+
eventsLink: 'See upcoming events',
|
|
36
|
+
},
|
|
31
37
|
hotelAffiliateCTA: {
|
|
32
38
|
headline: (name: string) => `Find the best rate for ${name}`,
|
|
33
39
|
bookCta: (noun: string) => `Book this ${noun}`,
|