@sarimarcus/content-sites-ui 0.49.3 → 0.50.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/package.json +2 -2
- package/src/affiliate/AffiliateCard.astro +24 -13
- package/src/affiliate/cardClasses.ts +5 -2
- package/src/affiliate/types.ts +2 -0
- package/src/editorial/EraChip.astro +3 -1
- package/src/editorial/EraPeopleRow.astro +66 -0
- package/src/editorial/PersonChip.astro +7 -2
- package/src/editorial/index.ts +1 -0
- package/src/internal/labels.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.50.0 (2026-10-27)
|
|
6
|
+
|
|
7
|
+
- `editorial`: new `EraPeopleRow`, the one compact row under an article intro: the era chip leads, then up to `visible` (default 3) name-only person chips, the rest behind a native `<details>` "+N more"; without an era a "People:" label leads. `EraChip` and `PersonChip` take an optional `size` (`sm`|`md`, default `md`, unchanged) and `PersonChip` a `showDates` (default true; dates stay in the accessible name). Defaults render identically to 0.49.4 (`tests/fixtures/render-diff/era-person-chip-defaults.json`). New label group `eraPeopleRow` (SLA-3535).
|
|
8
|
+
|
|
9
|
+
## 0.49.4 (2026-10-27)
|
|
10
|
+
|
|
11
|
+
- `affiliate`: `AffiliateCard` takes an optional `variant` through `AffiliateCardOptions`: `overlay` (default, unchanged look) or `quiet` (title under the photo, no gradient, outline CTA that fills on hover). On every card the trust lines (`labels.verified`, `labels.booksUp`) now sit above the CTA instead of below it, so the CTA closes the card and CTAs line up across a row however many lines each card shows: an HTML change on every page with affiliate cards (SLA-3515).
|
|
12
|
+
|
|
5
13
|
## 0.49.3 (2026-10-26)
|
|
6
14
|
|
|
7
15
|
- `composed`: `CardCarousel` takes an optional `staticFrom="sm"` and `trackClass`. With `staticFrom` the strip is a carousel on phones only: from `sm` up the track stops scrolling and lays its cards out as `trackClass` says, its controls stay hidden, and an empty header is hidden. Without the new props the markup is unchanged (`render-diff` against 0.49.2: identical HTML). The controller now also removes the track's `tabindex` when there is nothing to scroll, so a carousel that fits is no longer an empty focus stop, and never shows controls for a track whose overflow is visible (SLA-3515).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.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.50.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* Copy: neutral labels have English defaults. Lines that name a provider or make a claim (`labels.verified`,
|
|
11
11
|
* `labels.booksUp`, `cheapPriceFrame`, `skipQueueFrame`) render only when the site passes them.
|
|
12
12
|
*
|
|
13
|
+
* `variant="quiet"` puts the title under the photo and makes the CTA an outline button. The trust lines sit above the
|
|
14
|
+
* CTA, which closes the card, so CTAs line up across a row however many lines each card shows.
|
|
15
|
+
*
|
|
13
16
|
* Kept for byte-identical adoption, each meant to be dropped later: `legacyFractionDigits` (fractional prices then
|
|
14
17
|
* render with the currency's default maximum, e.g. "€8.5"), `skipQueueFrame` (shown over `cheapPriceFrame` when the
|
|
15
18
|
* title contains "skip"), and `halfStarIds="index"` (the half-star clip id repeats when two card groups share a page;
|
|
@@ -18,7 +21,7 @@
|
|
|
18
21
|
import type { ImageMetadata } from 'astro';
|
|
19
22
|
import { deterministicId } from '@sarimarcus/content-sites-core/dom';
|
|
20
23
|
import Badge from '../primitives/Badge.astro';
|
|
21
|
-
import { CARD_LINK_CLASS, CARD_BODY_CLASS, CARD_CTA_CLASS, CARD_BADGE_CLASS } from './cardClasses';
|
|
24
|
+
import { CARD_LINK_CLASS, CARD_BODY_CLASS, CARD_CTA_CLASS, CARD_CTA_QUIET_CLASS, CARD_BADGE_CLASS } from './cardClasses';
|
|
22
25
|
import Icon from '../primitives/Icon.astro';
|
|
23
26
|
import type { AffiliateCardOptions } from './types';
|
|
24
27
|
import { templateLine } from './templateText';
|
|
@@ -77,6 +80,7 @@ const {
|
|
|
77
80
|
titleColorClass = 'text-overlay-foreground',
|
|
78
81
|
booksUpClass = 'text-primary',
|
|
79
82
|
halfStarIds = 'deterministic',
|
|
83
|
+
variant = 'overlay',
|
|
80
84
|
class: className,
|
|
81
85
|
} = Astro.props;
|
|
82
86
|
|
|
@@ -168,15 +172,22 @@ const priceFrame = skipQueueFrame && title.toLowerCase().includes('skip')
|
|
|
168
172
|
class="w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
|
|
169
173
|
/>
|
|
170
174
|
)}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
class
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
{variant === 'overlay' && (
|
|
176
|
+
<Fragment>
|
|
177
|
+
<div class="absolute inset-0 bg-gradient-to-t from-overlay/95 via-overlay/40 to-transparent"></div>
|
|
178
|
+
<h3
|
|
179
|
+
class:list={["absolute bottom-3 left-4 right-4 text-xl sm:text-2xl font-semibold", titleColorClass, "leading-tight font-display [text-shadow:0_1px_3px_rgba(0,0,0,0.6)]"]}
|
|
180
|
+
>
|
|
181
|
+
{title}
|
|
182
|
+
</h3>
|
|
183
|
+
</Fragment>
|
|
184
|
+
)}
|
|
177
185
|
</div>
|
|
178
186
|
|
|
179
187
|
<div class={CARD_BODY_CLASS}>
|
|
188
|
+
{variant === 'quiet' && (
|
|
189
|
+
<h3 class="font-display text-lg font-medium leading-snug text-foreground mb-1.5">{title}</h3>
|
|
190
|
+
)}
|
|
180
191
|
<p class="text-base text-muted-foreground line-clamp-2 mb-3">
|
|
181
192
|
{description}
|
|
182
193
|
</p>{skipTheLineBadge && ' '}{isSkipTheLine && (
|
|
@@ -251,16 +262,16 @@ const priceFrame = skipQueueFrame && title.toLowerCase().includes('skip')
|
|
|
251
262
|
)}
|
|
252
263
|
|
|
253
264
|
<div class="mt-auto">
|
|
254
|
-
<span
|
|
255
|
-
class={CARD_CTA_CLASS}
|
|
256
|
-
>
|
|
257
|
-
<Icon name="ticket" class="w-4 h-4" aria-hidden="true" /><Fragment set:html={templateLine(cta)} /></span>
|
|
258
265
|
{hasReviews && verified && (
|
|
259
|
-
<p class="text-xs text-muted-foreground text-center
|
|
266
|
+
<p class="text-xs text-muted-foreground text-center mb-2"><Fragment set:html={templateLine(verified(formattedReviewCount))} /></p>
|
|
260
267
|
)}
|
|
261
268
|
{isBestSeller && booksUp && (
|
|
262
|
-
<p class:list={["text-xs", booksUpClass, "text-center
|
|
269
|
+
<p class:list={["text-xs", booksUpClass, "text-center mb-2"]}><Fragment set:html={templateLine(booksUp)} /></p>
|
|
263
270
|
)}
|
|
271
|
+
<span
|
|
272
|
+
class={variant === 'quiet' ? CARD_CTA_QUIET_CLASS : CARD_CTA_CLASS}
|
|
273
|
+
>
|
|
274
|
+
<Icon name="ticket" class="w-4 h-4" aria-hidden="true" /><Fragment set:html={templateLine(cta)} /></span>
|
|
264
275
|
</div>
|
|
265
276
|
</div>
|
|
266
277
|
</a>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
// Class strings AffiliateCard and AmazonProductCard share: the whole-card link, its body, the CTA bar and corner badge
|
|
1
|
+
// Class strings AffiliateCard and AmazonProductCard share: the whole-card link, its body, the CTA bar and corner badge
|
|
2
|
+
// (the quiet CTA is AffiliateCard's only).
|
|
2
3
|
export const CARD_LINK_CLASS = 'group relative bg-card rounded-xl overflow-hidden card-lift border border-border flex flex-col h-full no-underline text-inherit focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2';
|
|
3
4
|
export const CARD_BODY_CLASS = 'p-4 sm:p-5 flex flex-col flex-1';
|
|
4
|
-
|
|
5
|
+
const CTA_SHAPE = 'flex items-center justify-center gap-2 w-full';
|
|
6
|
+
export const CARD_CTA_CLASS = `${CTA_SHAPE} py-2.5 px-4 bg-primary text-primary-foreground font-medium rounded-lg group-hover:bg-primary/90 group-active:bg-primary/80 transition-colors`;
|
|
5
7
|
export const CARD_BADGE_CLASS = 'absolute top-3 left-3 z-10 pointer-events-none !px-2.5 !py-1 !font-semibold';
|
|
8
|
+
export const CARD_CTA_QUIET_CLASS = `${CTA_SHAPE} py-2 px-4 border border-foreground/25 text-foreground font-medium rounded-lg group-hover:bg-primary group-hover:border-primary group-hover:text-primary-foreground transition-colors`;
|
package/src/affiliate/types.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface AffiliateCardOptions {
|
|
|
24
24
|
titleColorClass?: string;
|
|
25
25
|
booksUpClass?: string;
|
|
26
26
|
halfStarIds?: 'deterministic' | 'index';
|
|
27
|
+
/** `overlay` (default): title over the photo, solid CTA. `quiet`: title under the photo, outline CTA. */
|
|
28
|
+
variant?: 'overlay' | 'quiet';
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
/** One card in an AffiliateCardSection or AffiliateCarousel: the card's own props, resolved by the site. */
|
|
@@ -17,6 +17,7 @@ interface Props {
|
|
|
17
17
|
icon?: string;
|
|
18
18
|
/** Opaque scrim tone for a chip laid over a photo or the hero overlay. */
|
|
19
19
|
onImage?: boolean;
|
|
20
|
+
size?: 'sm' | 'md';
|
|
20
21
|
class?: string;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -26,6 +27,7 @@ const {
|
|
|
26
27
|
ariaLabel = (e: EraDefinition) => LABELS.eraChip.ariaLabel(e.label, e.rangeLabel),
|
|
27
28
|
icon = 'history',
|
|
28
29
|
onImage = false,
|
|
30
|
+
size = 'md',
|
|
29
31
|
class: className,
|
|
30
32
|
}: Props = Astro.props;
|
|
31
33
|
---
|
|
@@ -34,7 +36,7 @@ const {
|
|
|
34
36
|
<Chip
|
|
35
37
|
as="a"
|
|
36
38
|
href={eraHref(era, basePath)}
|
|
37
|
-
size=
|
|
39
|
+
size={size}
|
|
38
40
|
tone={onImage ? 'onImage' : 'tint'}
|
|
39
41
|
accent="primary"
|
|
40
42
|
icon={icon}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* EraPeopleRow — the one compact row under an article intro: the era chip leads, then up to `visible` name-only person
|
|
4
|
+
* chips, the rest behind a native <details> "+N more". Without an era a "People:" label leads. Renders nothing when
|
|
5
|
+
* there is neither an era nor a person. The sm chips are 28px tall; `hit` stretches each tap target to 44px.
|
|
6
|
+
*/
|
|
7
|
+
import type { EraDefinition } from '@sarimarcus/content-sites-core/eras';
|
|
8
|
+
import EraChip from './EraChip.astro';
|
|
9
|
+
import PersonChip from './PersonChip.astro';
|
|
10
|
+
import { PILL_BASE } from '../primitives/pillRecipe';
|
|
11
|
+
import { LABELS } from '../internal/labels';
|
|
12
|
+
|
|
13
|
+
interface Person {
|
|
14
|
+
name: string;
|
|
15
|
+
href: string;
|
|
16
|
+
dates?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
era?: EraDefinition;
|
|
21
|
+
eraBasePath?: string;
|
|
22
|
+
people?: readonly Person[];
|
|
23
|
+
visible?: number;
|
|
24
|
+
label?: string;
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
era,
|
|
30
|
+
eraBasePath,
|
|
31
|
+
people = [],
|
|
32
|
+
visible = 3,
|
|
33
|
+
label = LABELS.eraPeopleRow.peopleLabel,
|
|
34
|
+
class: className,
|
|
35
|
+
}: Props = Astro.props;
|
|
36
|
+
const valid = people.filter((p) => p.name && p.href);
|
|
37
|
+
const shown = valid.slice(0, visible);
|
|
38
|
+
const rest = valid.slice(visible);
|
|
39
|
+
const hit = "relative before:absolute before:inset-x-0 before:-inset-y-2 before:content-['']";
|
|
40
|
+
const chip = (p: Person) => ({ name: p.name, href: p.href, dates: p.dates, size: 'sm' as const, showDates: false, class: hit });
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
{(era || valid.length > 0) && (
|
|
44
|
+
<div class:list={['flex flex-wrap items-center gap-x-2 gap-y-3', className]} data-era-people-row>
|
|
45
|
+
{era ? <EraChip era={era} basePath={eraBasePath} size="sm" class={hit} /> : (
|
|
46
|
+
<span class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{label}</span>
|
|
47
|
+
)}
|
|
48
|
+
{valid.length > 0 && (
|
|
49
|
+
<ul class="flex flex-wrap items-center gap-x-1.5 gap-y-3" aria-label={era ? label : undefined}>
|
|
50
|
+
{shown.map((p) => <li><PersonChip {...chip(p)} /></li>)}
|
|
51
|
+
{rest.length > 0 && (
|
|
52
|
+
<li>
|
|
53
|
+
<details class="group">
|
|
54
|
+
<summary
|
|
55
|
+
class:list={[PILL_BASE, hit, 'cursor-pointer list-none border border-border px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary [&::-webkit-details-marker]:hidden']}
|
|
56
|
+
>{LABELS.eraPeopleRow.more(rest.length)}<span class="sr-only">{LABELS.eraPeopleRow.moreSr}</span></summary>
|
|
57
|
+
<ul class="mt-3 flex flex-wrap gap-x-1.5 gap-y-3">
|
|
58
|
+
{rest.map((p) => <li><PersonChip {...chip(p)} /></li>)}
|
|
59
|
+
</ul>
|
|
60
|
+
</details>
|
|
61
|
+
</li>
|
|
62
|
+
)}
|
|
63
|
+
</ul>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
@@ -14,6 +14,9 @@ interface Props {
|
|
|
14
14
|
/** Accessible name; keep the visible name and dates in it. */
|
|
15
15
|
ariaLabel?: (name: string, dates?: string) => string;
|
|
16
16
|
icon?: string;
|
|
17
|
+
size?: 'sm' | 'md';
|
|
18
|
+
/** Set false to drop the visible life dates; they stay in the accessible name. */
|
|
19
|
+
showDates?: boolean;
|
|
17
20
|
class?: string;
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -23,6 +26,8 @@ const {
|
|
|
23
26
|
dates,
|
|
24
27
|
ariaLabel = LABELS.personChip.ariaLabel,
|
|
25
28
|
icon = 'user',
|
|
29
|
+
size = 'md',
|
|
30
|
+
showDates = true,
|
|
26
31
|
class: className,
|
|
27
32
|
}: Props = Astro.props;
|
|
28
33
|
---
|
|
@@ -31,7 +36,7 @@ const {
|
|
|
31
36
|
<Chip
|
|
32
37
|
as="a"
|
|
33
38
|
href={href}
|
|
34
|
-
size=
|
|
39
|
+
size={size}
|
|
35
40
|
tone="tint"
|
|
36
41
|
accent="primary"
|
|
37
42
|
icon={icon}
|
|
@@ -39,6 +44,6 @@ const {
|
|
|
39
44
|
aria-label={ariaLabel(name, dates)}
|
|
40
45
|
class={className}
|
|
41
46
|
>
|
|
42
|
-
{name}{dates && (<><span aria-hidden="true">·</span><span class="whitespace-nowrap tabular-nums">{dates}</span></>)}
|
|
47
|
+
{name}{showDates && dates && (<><span aria-hidden="true">·</span><span class="whitespace-nowrap tabular-nums">{dates}</span></>)}
|
|
43
48
|
</Chip>
|
|
44
49
|
)}
|
package/src/editorial/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type { InsiderTip, InsiderTipAuthor, InsiderTipKinds, InsiderTipTone } fr
|
|
|
31
31
|
export { default as AuthorStrip } from './AuthorStrip.astro';
|
|
32
32
|
export { default as EraChip } from './EraChip.astro';
|
|
33
33
|
export { default as PersonChip } from './PersonChip.astro';
|
|
34
|
+
export { default as EraPeopleRow } from './EraPeopleRow.astro';
|
|
34
35
|
export { default as PersonCard } from './PersonCard.astro';
|
|
35
36
|
export { default as PersonPage } from './PersonPage.astro';
|
|
36
37
|
export { default as AlsoExplore } from './AlsoExplore.astro';
|
package/src/internal/labels.ts
CHANGED
|
@@ -83,6 +83,7 @@ export const LABELS = {
|
|
|
83
83
|
articleFeatureCard: { readLabel: 'Read article', updatedLabel: 'Updated' },
|
|
84
84
|
eraChip: { ariaLabel: (label: string, range: string) => `${label}, ${range}: see this era on the chronology` },
|
|
85
85
|
personChip: { ariaLabel: (name: string, dates?: string) => `${name}${dates ? `, ${dates}` : ''}: read their profile` },
|
|
86
|
+
eraPeopleRow: { peopleLabel: 'People:', more: (n: number) => `+${n} more`, moreSr: ' people' },
|
|
86
87
|
personCard: { cta: 'Read the profile' },
|
|
87
88
|
peopleTimeline: {
|
|
88
89
|
ariaLabel: 'People by era',
|