@sarimarcus/content-sites-ui 0.57.0 → 0.57.1
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 +20 -0
- package/package.json +2 -2
- package/src/composed/TableOfContents.astro +1 -1
- package/src/composed/toc.ts +1 -0
- package/src/editorial/ArticleCard.astro +14 -6
- package/src/editorial/ArticleCardGrid.astro +9 -3
- package/src/editorial/ArticleFeatureCard.astro +5 -4
- package/src/editorial/ArticleGrid.astro +7 -3
- package/src/editorial/ArticlePage.astro +58 -14
- package/src/editorial/ArticleTagPage.astro +11 -4
- package/src/editorial/ArticleTopicPage.astro +2 -2
- package/src/editorial/ArticlesListingPage.astro +3 -2
- package/src/editorial/AuthorPage.astro +10 -7
- package/src/editorial/AuthorsIndexPage.astro +1 -1
- package/src/editorial/article-page.ts +6 -0
- package/src/editorial/author-page.ts +7 -0
- package/src/editorial/index.ts +2 -1
- package/src/editorial/interludes/ComparisonTable.astro +1 -1
- package/src/internal/labels.ts +18 -0
- package/src/layout/ContentHero.astro +66 -3
- package/src/navigation/SiteHeader.astro +7 -3
- package/src/seo/ArticleMetadata.astro +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.57.1 (2026-11-05)
|
|
6
|
+
|
|
7
|
+
Theming hooks and opt-in variants for the editorial listing, author and article pages (SLA-3887). Defaults keep today's markup apart from the hooks and fixes listed under "Output changes".
|
|
8
|
+
|
|
9
|
+
- `ArticleCard`, `ArticleFeatureCard`: `data-card`, `data-card-media`, `data-card-body` hooks; `ArticleCard` gains `layout` (`stack` | `wide`, `data-card-layout`) and `bodyClass`. `ArticleGrid` and `ArticleCardGrid` gain `single` (`grid` | `wide`: a lone article renders as a full-row side-by-side card) and `bodyClass`.
|
|
10
|
+
- `ArticlesListingPage`, `ArticleTopicPage`: `eyebrow` is optional (no kicker when absent). `ArticleTagPage`: `eyebrow={false}` omits it; new `relatedTagsLimit` and `showRelatedTags`.
|
|
11
|
+
- `AuthorPage`: `portraitShape` (`square` | `circle`); hooks `data-author-portrait`, `data-author-credentials`, `data-author-work-list`, `data-author-chip`. `AuthorsIndexPage`: `data-authors-cards` on the cards wrapper. `ArticleTopicPage`: `data-topic-author` on author cards.
|
|
12
|
+
- `ContentHero`: `variant` (`overlay` default, `split`: solid band with the photo right, `mediaShape="circle"` crops it round; `rail`: info and actions slots in a left rail beside the headline, photo full width below) and hooks `data-hero`, `data-hero-media`, `data-hero-title`.
|
|
13
|
+
- `ArticlePage`: `heroVariant`, `heroMediaShape`, `showShareTop`, `showShareBottom`, `showDates`, `breadcrumbBandClass` (replaces the band classes, e.g. to clear a taller header). `ArticleMetadata`: `showDates`, `data-byline-avatar` on the avatar.
|
|
14
|
+
- `SiteHeader`: `desktopBreakpoint` (`lg` default | `xl`), so six category links can wait for 1280px. The menu-open scroll lock still releases at 1024px, so an open menu closes when the viewport crosses it.
|
|
15
|
+
- `editorial`: `editorialAuthorWorkConfig(locale)` and `getInterludeLabels(locale)` (English and Italian); the English exports are unchanged.
|
|
16
|
+
|
|
17
|
+
### Output changes
|
|
18
|
+
|
|
19
|
+
- Card photos now fill their 4:3 box: the `picture` wrapper is `block w-full h-full` (it was inline, which left a gap under a shorter image).
|
|
20
|
+
- The idle `TableOfContents` mini bar is `invisible` as well as translated out, so no sliver shows under the fixed header.
|
|
21
|
+
- `ComparisonTable`: the last row, not the last cell of every row, drops its bottom border.
|
|
22
|
+
- `AuthorPage`: the "explore by topic" chips render only when there are two or more groups.
|
|
23
|
+
- Listing and tag page headers differ in whitespace only.
|
|
24
|
+
|
|
5
25
|
## 0.57.0 (2026-11-05)
|
|
6
26
|
|
|
7
27
|
- `ArticlePage`: the breadcrumb band always precedes the hero (it followed the hero when an image was set), the hero is `minHeight="short"` with no hardcoded `mt-16`, interludes render inside `not-prose` with primary-coloured links underlined only on hover, and the lede loses its `text-lg sm:text-xl leading-relaxed` utilities to the new `article-lede.css`. The ToC now shows the localised "In this article" heading by default, desktop only (`articlePage.tocEyebrow`, EN and IT) (SLA-3871).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.1",
|
|
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",
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"@lucide/astro": "^1.23.0",
|
|
52
52
|
"astro": "^7.0.6",
|
|
53
53
|
"tailwindcss": "^4.1.18",
|
|
54
|
-
"@sarimarcus/content-sites-core": "0.57.
|
|
54
|
+
"@sarimarcus/content-sites-core": "0.57.1"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -77,7 +77,7 @@ const showMini = variant === 'card';
|
|
|
77
77
|
data-toc-mini
|
|
78
78
|
data-toc
|
|
79
79
|
data-toc-section-selector={sectionSelector}
|
|
80
|
-
class="fixed top-16 left-0 right-0 z-40 translate-y-[-100%] opacity-0 pointer-events-none transition-[transform,opacity] duration-300 ease-out bg-background/95 backdrop-blur-sm border-b border-border shadow-sm"
|
|
80
|
+
class="invisible fixed top-16 left-0 right-0 z-40 translate-y-[-100%] opacity-0 pointer-events-none transition-[transform,opacity,visibility] duration-300 ease-out bg-background/95 backdrop-blur-sm border-b border-border shadow-sm"
|
|
81
81
|
aria-hidden="true"
|
|
82
82
|
inert
|
|
83
83
|
>
|
package/src/composed/toc.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
let cleanup: (() => void) | null = null;
|
|
6
6
|
|
|
7
7
|
function setMiniVisible(mini: Element, visible: boolean): void {
|
|
8
|
+
mini.classList.toggle('invisible', !visible);
|
|
8
9
|
mini.classList.toggle('translate-y-[-100%]', !visible);
|
|
9
10
|
mini.classList.toggle('opacity-0', !visible);
|
|
10
11
|
mini.classList.toggle('pointer-events-none', !visible);
|
|
@@ -14,33 +14,41 @@ interface Props {
|
|
|
14
14
|
readLabel: string;
|
|
15
15
|
updatedLabel: string;
|
|
16
16
|
loading?: 'eager' | 'lazy';
|
|
17
|
+
/** `wide` lays the image and text side by side from `sm` (a lone card in a grid). */
|
|
18
|
+
layout?: 'stack' | 'wide';
|
|
19
|
+
/** Classes of the text block; the default is the stock padding and column. */
|
|
20
|
+
bodyClass?: string;
|
|
17
21
|
/** Keep the card out of the search index (listings that are themselves indexed). */
|
|
18
22
|
pagefindIgnore?: boolean;
|
|
19
23
|
class?: string;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
const { article: a, readLabel, updatedLabel, loading = 'lazy', pagefindIgnore = false, class: className } = Astro.props;
|
|
26
|
+
const { article: a, readLabel, updatedLabel, loading = 'lazy', layout = 'stack', bodyClass = 'p-5 flex-1 flex flex-col', pagefindIgnore = false, class: className } = Astro.props;
|
|
27
|
+
const wide = layout === 'wide';
|
|
23
28
|
---
|
|
24
29
|
|
|
25
30
|
<a
|
|
26
31
|
href={a.href}
|
|
32
|
+
data-card
|
|
33
|
+
data-card-layout={wide ? 'wide' : undefined}
|
|
27
34
|
data-pagefind-ignore={pagefindIgnore ? '' : undefined}
|
|
28
|
-
class:list={['group flex flex-col rounded-xl border border-border bg-card overflow-hidden hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary/50', className]}
|
|
35
|
+
class:list={['group flex flex-col rounded-xl border border-border bg-card overflow-hidden hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary/50', wide && 'sm:flex-row sm:items-stretch', className]}
|
|
29
36
|
>
|
|
30
37
|
{a.image ? (
|
|
31
|
-
<div class=
|
|
38
|
+
<div data-card-media class:list={['aspect-[4/3] overflow-hidden', wide && 'sm:aspect-[16/10] sm:w-[58%] sm:shrink-0']}>
|
|
32
39
|
<ResponsivePicture
|
|
33
40
|
src={a.image}
|
|
34
41
|
alt={a.imageAlt ?? ''}
|
|
35
|
-
sizes=
|
|
42
|
+
sizes={wide ? '(max-width: 640px) 100vw, 58vw' : '(max-width: 640px) 100vw, 33vw'}
|
|
36
43
|
class="w-full h-full object-cover motion-safe:transition-transform motion-safe:duration-500 motion-safe:group-hover:scale-105"
|
|
37
44
|
loading={loading}
|
|
45
|
+
pictureAttributes={{ class: 'block w-full h-full' }}
|
|
38
46
|
/>
|
|
39
47
|
</div>
|
|
40
48
|
) : (
|
|
41
|
-
<div class=
|
|
49
|
+
<div data-card-media class:list={['aspect-[4/3] bg-muted/40', wide && 'sm:aspect-[16/10] sm:w-[58%] sm:shrink-0']}></div>
|
|
42
50
|
)}
|
|
43
|
-
<div class=
|
|
51
|
+
<div data-card-body class:list={[bodyClass, wide && 'sm:justify-center']}>{(a.categoryLabel || a.tagLabel) && (
|
|
44
52
|
<div class="mb-2 flex flex-wrap items-center gap-2 text-xs">
|
|
45
53
|
{a.categoryLabel && (
|
|
46
54
|
<span class="font-semibold uppercase tracking-wider text-primary">{a.categoryLabel}</span>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* ArticleCardGrid — the article listing grid (ui ArticleGrid) from article collection entries: the date label shows
|
|
4
4
|
* the last update when it falls on another calendar day than publication, formatted in `timeZone`.
|
|
5
|
-
* Supports optional category/tag badges and reading-time labels for editorial sites
|
|
6
|
-
*
|
|
5
|
+
* Supports optional category/tag badges and reading-time labels for editorial sites. Its cards carry `data-card*`
|
|
6
|
+
* hooks, and `single="wide"` / `bodyClass` are opt-in; the defaults render the stock markup.
|
|
7
7
|
*/
|
|
8
8
|
import type { ImageMetadata } from 'astro';
|
|
9
9
|
import { isUpdatedAfterPublication } from '@sarimarcus/content-sites-core/articles';
|
|
@@ -48,6 +48,10 @@ interface Props {
|
|
|
48
48
|
routes?: SiteRoutes;
|
|
49
49
|
/** Grid column count when `class` is not supplied (defaults to 3). */
|
|
50
50
|
columns?: 2 | 3;
|
|
51
|
+
/** `wide` renders a lone article as a full-row side-by-side card. */
|
|
52
|
+
single?: 'grid' | 'wide';
|
|
53
|
+
/** Classes of each card's text block. */
|
|
54
|
+
bodyClass?: string;
|
|
51
55
|
/** Grid classes; defaults to 1/2/3 columns (or 1/2 when `columns={2}`). */
|
|
52
56
|
class?: string;
|
|
53
57
|
}
|
|
@@ -65,6 +69,8 @@ const {
|
|
|
65
69
|
updatedLabel = getLabels(locale).articleCardGrid.updatedLabel,
|
|
66
70
|
routes,
|
|
67
71
|
columns = 3,
|
|
72
|
+
single = 'grid',
|
|
73
|
+
bodyClass,
|
|
68
74
|
class: className = columns === 2 ? 'grid gap-6 sm:grid-cols-2' : 'grid gap-6 sm:grid-cols-2 lg:grid-cols-3',
|
|
69
75
|
} = Astro.props;
|
|
70
76
|
|
|
@@ -96,4 +102,4 @@ const items = articles.map(({ data: a }) => {
|
|
|
96
102
|
});
|
|
97
103
|
---
|
|
98
104
|
|
|
99
|
-
<ArticleGrid articles={items} readLabel={readLabel} updatedLabel={updatedLabel} eagerFirst={eagerFirst} class={className} />
|
|
105
|
+
<ArticleGrid articles={items} readLabel={readLabel} updatedLabel={updatedLabel} eagerFirst={eagerFirst} single={single} bodyClass={bodyClass} class={className} />
|
|
@@ -40,10 +40,10 @@ const { href, title, description, author, label, image, imageAlt = '', dateTime,
|
|
|
40
40
|
const Heading = `h${headingLevel}` as 'h2' | 'h3';
|
|
41
41
|
---
|
|
42
42
|
|
|
43
|
-
<a href={href} data-pagefind-ignore={pagefindIgnore ? '' : undefined} class:list={['group block', className, 'rounded-xl border border-border bg-card overflow-hidden hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary/50']}>
|
|
43
|
+
<a href={href} data-card data-card-layout="feature" data-pagefind-ignore={pagefindIgnore ? '' : undefined} class:list={['group block', className, 'rounded-xl border border-border bg-card overflow-hidden hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary/50']}>
|
|
44
44
|
<div class="grid sm:grid-cols-[1.2fr_1fr] gap-0">
|
|
45
45
|
{image ? (
|
|
46
|
-
<div class="aspect-[4/3] sm:aspect-auto overflow-hidden">
|
|
46
|
+
<div data-card-media class="aspect-[4/3] sm:aspect-auto overflow-hidden">
|
|
47
47
|
<ResponsivePicture
|
|
48
48
|
src={image}
|
|
49
49
|
alt={imageAlt}
|
|
@@ -51,12 +51,13 @@ const Heading = `h${headingLevel}` as 'h2' | 'h3';
|
|
|
51
51
|
class="w-full h-full object-cover motion-safe:transition-transform motion-safe:duration-500 motion-safe:group-hover:scale-105"
|
|
52
52
|
loading={loading}
|
|
53
53
|
fetchpriority={loading === 'eager' ? 'high' : undefined}
|
|
54
|
+
pictureAttributes={{ class: 'block w-full h-full' }}
|
|
54
55
|
/>
|
|
55
56
|
</div>
|
|
56
57
|
) : (
|
|
57
|
-
<div class="aspect-[4/3] sm:aspect-auto bg-muted/40"></div>
|
|
58
|
+
<div data-card-media class="aspect-[4/3] sm:aspect-auto bg-muted/40"></div>
|
|
58
59
|
)}
|
|
59
|
-
<div class="p-6 sm:p-8 flex flex-col justify-center">
|
|
60
|
+
<div data-card-body class="p-6 sm:p-8 flex flex-col justify-center">
|
|
60
61
|
{label && <p class="text-xs font-semibold uppercase tracking-[0.18em] text-primary mb-2">{label}</p>}
|
|
61
62
|
<Heading class="text-xl sm:text-2xl font-semibold font-display text-foreground leading-snug group-hover:text-primary transition-colors text-balance">
|
|
62
63
|
{title}
|
|
@@ -9,16 +9,20 @@ interface Props {
|
|
|
9
9
|
updatedLabel: string;
|
|
10
10
|
eagerFirst?: boolean;
|
|
11
11
|
pagefindIgnore?: boolean;
|
|
12
|
+
/** `wide` renders a lone article as a full-row side-by-side card. */
|
|
13
|
+
single?: 'grid' | 'wide';
|
|
14
|
+
bodyClass?: string;
|
|
12
15
|
class?: string;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
const { articles, readLabel, updatedLabel, eagerFirst = false, pagefindIgnore = false, class: className = 'grid gap-6 sm:grid-cols-2' } = Astro.props;
|
|
18
|
+
const { articles, readLabel, updatedLabel, eagerFirst = false, pagefindIgnore = false, single = 'grid', bodyClass, class: className = 'grid gap-6 sm:grid-cols-2' } = Astro.props;
|
|
19
|
+
const wide = single === 'wide' && articles.length === 1;
|
|
16
20
|
---
|
|
17
21
|
|
|
18
22
|
{articles.length > 0 && (
|
|
19
|
-
<div class={className}>
|
|
23
|
+
<div class={wide ? 'grid gap-6' : className}>
|
|
20
24
|
{articles.map((article, idx) => (
|
|
21
|
-
<ArticleCard article={article} readLabel={readLabel} updatedLabel={updatedLabel} loading={eagerFirst && idx === 0 ? 'eager' : 'lazy'} pagefindIgnore={pagefindIgnore} />
|
|
25
|
+
<ArticleCard article={article} readLabel={readLabel} updatedLabel={updatedLabel} loading={eagerFirst && idx === 0 ? 'eager' : 'lazy'} layout={wide ? 'wide' : 'stack'} bodyClass={bodyClass} pagefindIgnore={pagefindIgnore} />
|
|
22
26
|
))}
|
|
23
27
|
</div>
|
|
24
28
|
)}
|
|
@@ -99,6 +99,16 @@ interface Props {
|
|
|
99
99
|
/** Render ShareButtons below byline and at end of article body (SLA-3718). */
|
|
100
100
|
shareUrl?: string;
|
|
101
101
|
showShareButtons?: boolean;
|
|
102
|
+
/** With `showShareButtons`, show the bar under the byline (default) and/or after the body (default). */
|
|
103
|
+
showShareTop?: boolean;
|
|
104
|
+
showShareBottom?: boolean;
|
|
105
|
+
/** Print the dates in the byline (default). */
|
|
106
|
+
showDates?: boolean;
|
|
107
|
+
/** Article head: the photo-behind-title `overlay` (default), a solid `split` band, or a `rail` of byline and share beside the headline. */
|
|
108
|
+
heroVariant?: 'overlay' | 'split' | 'rail';
|
|
109
|
+
heroMediaShape?: 'rect' | 'circle';
|
|
110
|
+
/** Replaces the breadcrumb band's classes; keep its top padding to clear the fixed header. */
|
|
111
|
+
breadcrumbBandClass?: string;
|
|
102
112
|
/** Enable decorative drop-cap on the lede paragraph when it starts with a letter/quote. */
|
|
103
113
|
dropCap?: boolean;
|
|
104
114
|
/** Emit hidden sr-only audience spans for Pagefind facet filtering. */
|
|
@@ -159,6 +169,12 @@ const {
|
|
|
159
169
|
routes = {},
|
|
160
170
|
shareUrl,
|
|
161
171
|
showShareButtons = false,
|
|
172
|
+
showShareTop = true,
|
|
173
|
+
showShareBottom = true,
|
|
174
|
+
showDates = true,
|
|
175
|
+
heroVariant = 'overlay',
|
|
176
|
+
heroMediaShape = 'rect',
|
|
177
|
+
breadcrumbBandClass,
|
|
162
178
|
dropCap = false,
|
|
163
179
|
emitAudienceFacets = false,
|
|
164
180
|
noHeroEyebrow,
|
|
@@ -179,6 +195,7 @@ const {
|
|
|
179
195
|
relatedProps = {},
|
|
180
196
|
backLink = null,
|
|
181
197
|
} = Astro.props;
|
|
198
|
+
const railHead = heroVariant === 'rail' && !!heroImage;
|
|
182
199
|
|
|
183
200
|
const l = getLabels(locale).articlePage;
|
|
184
201
|
const sourcesLen = article.sources?.length ?? 0;
|
|
@@ -289,20 +306,46 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
289
306
|
<span class="sr-only" data-pagefind-filter={`audience:${a}`}>{a}</span>
|
|
290
307
|
))}
|
|
291
308
|
|
|
292
|
-
<BreadcrumbBand>
|
|
309
|
+
<BreadcrumbBand class={breadcrumbBandClass}>
|
|
293
310
|
<Breadcrumb items={breadcrumbs} {...breadcrumbProps} />
|
|
294
311
|
</BreadcrumbBand>
|
|
295
312
|
|
|
296
313
|
{heroImage ? (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
314
|
+
railHead ? (
|
|
315
|
+
<ContentHero
|
|
316
|
+
title={article.title}
|
|
317
|
+
description={article.description}
|
|
318
|
+
image={heroImage}
|
|
319
|
+
imageAlt={article.imageAlt}
|
|
320
|
+
imageTitle={article.imageTitle}
|
|
321
|
+
variant="rail"
|
|
322
|
+
mediaShape={heroMediaShape}
|
|
323
|
+
>
|
|
324
|
+
<Fragment slot="info"><ArticleMetadata
|
|
325
|
+
author={author}
|
|
326
|
+
datePublished={article.datePublished}
|
|
327
|
+
dateModified={article.dateModified}
|
|
328
|
+
timeZone={timeZone}
|
|
329
|
+
locale={locale}
|
|
330
|
+
showDates={showDates}
|
|
331
|
+
era={era}
|
|
332
|
+
eraBasePath={eraBasePath}
|
|
333
|
+
/></Fragment>
|
|
334
|
+
<Fragment slot="actions">{showShareButtons && shareUrl && showShareTop && <ShareButtons url={shareUrl} title={article.title} locale={locale} />}</Fragment>
|
|
335
|
+
</ContentHero>
|
|
336
|
+
) : (
|
|
337
|
+
<ContentHero
|
|
338
|
+
title={article.title}
|
|
339
|
+
description={article.description}
|
|
340
|
+
image={heroImage}
|
|
341
|
+
imageAlt={article.imageAlt}
|
|
342
|
+
imageTitle={article.imageTitle}
|
|
343
|
+
overlay="editorial"
|
|
344
|
+
minHeight="short"
|
|
345
|
+
variant={heroVariant}
|
|
346
|
+
mediaShape={heroMediaShape}
|
|
347
|
+
/>
|
|
348
|
+
)
|
|
306
349
|
) : (
|
|
307
350
|
<header class="pt-10 pb-6 border-b border-border">
|
|
308
351
|
<Container size="measure">
|
|
@@ -317,17 +360,18 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
317
360
|
|
|
318
361
|
<main>
|
|
319
362
|
<Container size="measure" class="py-10 sm:py-14">
|
|
320
|
-
<ArticleMetadata
|
|
363
|
+
{!railHead && <ArticleMetadata
|
|
321
364
|
author={author}
|
|
322
365
|
datePublished={article.datePublished}
|
|
323
366
|
dateModified={article.dateModified}
|
|
324
367
|
timeZone={timeZone}
|
|
325
368
|
locale={locale}
|
|
369
|
+
showDates={showDates}
|
|
326
370
|
era={era}
|
|
327
371
|
eraBasePath={eraBasePath}
|
|
328
|
-
/>
|
|
372
|
+
/>}
|
|
329
373
|
|
|
330
|
-
{showShareButtons && shareUrl && (
|
|
374
|
+
{showShareButtons && shareUrl && showShareTop && !railHead && (
|
|
331
375
|
<div class="mb-6">
|
|
332
376
|
<ShareButtons url={shareUrl} title={article.title} locale={locale} />
|
|
333
377
|
</div>
|
|
@@ -455,7 +499,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
455
499
|
</nav>
|
|
456
500
|
)}
|
|
457
501
|
|
|
458
|
-
{showShareButtons && shareUrl && (
|
|
502
|
+
{showShareButtons && shareUrl && showShareBottom && (
|
|
459
503
|
<div class="mt-8 pt-6 border-t border-border" data-pagefind-ignore>
|
|
460
504
|
<ShareButtons url={shareUrl} title={article.title} locale={locale} />
|
|
461
505
|
</div>
|
|
@@ -21,7 +21,8 @@ export interface ArticleTagPill {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
interface Props {
|
|
24
|
-
|
|
24
|
+
/** Pass `false` to render no kicker. */
|
|
25
|
+
eyebrow?: string | false;
|
|
25
26
|
heading: string;
|
|
26
27
|
lede: string;
|
|
27
28
|
tag: string;
|
|
@@ -29,6 +30,9 @@ interface Props {
|
|
|
29
30
|
articles?: readonly { data: { category?: string | null } }[];
|
|
30
31
|
categories?: Readonly<Record<string, ArticleCategoryMeta>>;
|
|
31
32
|
relatedTags?: readonly ArticleTagPill[];
|
|
33
|
+
/** Chips shown in the tag row (all by default). */
|
|
34
|
+
relatedTagsLimit?: number;
|
|
35
|
+
showRelatedTags?: boolean;
|
|
32
36
|
locale?: string;
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -41,10 +45,13 @@ const {
|
|
|
41
45
|
articles = [],
|
|
42
46
|
categories,
|
|
43
47
|
relatedTags = [],
|
|
48
|
+
relatedTagsLimit,
|
|
49
|
+
showRelatedTags = true,
|
|
44
50
|
locale,
|
|
45
51
|
} = Astro.props;
|
|
46
52
|
const l = getLabels(locale).articleTagPage;
|
|
47
|
-
const resolvedEyebrow = eyebrow ?? l.eyebrow;
|
|
53
|
+
const resolvedEyebrow = eyebrow === false ? undefined : (eyebrow ?? l.eyebrow);
|
|
54
|
+
const shownTags = relatedTagsLimit === undefined ? relatedTags : relatedTags.slice(0, relatedTagsLimit);
|
|
48
55
|
const countWord = count === 1 ? l.countOne : l.countMany;
|
|
49
56
|
---
|
|
50
57
|
|
|
@@ -59,9 +66,9 @@ const countWord = count === 1 ? l.countOne : l.countMany;
|
|
|
59
66
|
<ArticleCategoryNav articles={articles} categories={categories} class="mb-8" />
|
|
60
67
|
)}
|
|
61
68
|
|
|
62
|
-
{relatedTags.length > 1 && (
|
|
69
|
+
{showRelatedTags && relatedTags.length > 1 && (
|
|
63
70
|
<div class="mb-10 flex flex-wrap items-center gap-2">
|
|
64
|
-
{
|
|
71
|
+
{shownTags.map((item) => {
|
|
65
72
|
const active = item.tag === tag;
|
|
66
73
|
return (
|
|
67
74
|
<Chip
|
|
@@ -22,7 +22,7 @@ import ArticleCategoryNav from './ArticleCategoryNav.astro';
|
|
|
22
22
|
import type { ArticleCategoryMeta, TopicAuthorCard } from './types';
|
|
23
23
|
|
|
24
24
|
interface Props {
|
|
25
|
-
eyebrow
|
|
25
|
+
eyebrow?: string;
|
|
26
26
|
heading: string;
|
|
27
27
|
lede: string;
|
|
28
28
|
/** Every article, for the topic nav's counts. */
|
|
@@ -88,7 +88,7 @@ const faqHtml = hub && Astro.slots.has('faq') ? (await Astro.slots.render('faq')
|
|
|
88
88
|
<h2 id="topic-authors-heading" class="text-xl font-semibold font-display text-foreground mb-5">{authors.heading}</h2>
|
|
89
89
|
<div class="grid gap-4 sm:grid-cols-3">
|
|
90
90
|
{authors.items.map((a) => (
|
|
91
|
-
<a href={a.href} class="block rounded-xl border border-border bg-card p-5 hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary/50">
|
|
91
|
+
<a href={a.href} data-topic-author class="block rounded-xl border border-border bg-card p-5 hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary/50">
|
|
92
92
|
<span class="block font-semibold text-foreground">{a.name}</span>
|
|
93
93
|
<span class="mt-1 block text-xs text-muted-foreground">{a.countLabel}</span>
|
|
94
94
|
{a.credentials && <span class="mt-2 block text-sm text-muted-foreground line-clamp-3">{a.credentials}</span>}
|
|
@@ -9,7 +9,8 @@ import BreadcrumbBand from '../layout/BreadcrumbBand.astro';
|
|
|
9
9
|
import Container from '../layout/Container.astro';
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
|
-
|
|
12
|
+
/** Kicker above the heading; omitted when empty. */
|
|
13
|
+
eyebrow?: string;
|
|
13
14
|
heading: string;
|
|
14
15
|
lede: string;
|
|
15
16
|
/** Mark <main> as the Pagefind body. */
|
|
@@ -25,7 +26,7 @@ const { eyebrow, heading, lede, pagefindBody = false } = Astro.props;
|
|
|
25
26
|
|
|
26
27
|
<header class="bg-muted/30 border-b border-border pt-12 pb-10">
|
|
27
28
|
<Container size="measure">
|
|
28
|
-
<p class="text-sm font-semibold uppercase tracking-[0.18em] text-primary mb-3">{eyebrow}</p>
|
|
29
|
+
{eyebrow && <p class="text-sm font-semibold uppercase tracking-[0.18em] text-primary mb-3">{eyebrow}</p>}
|
|
29
30
|
<h1 class="text-3xl sm:text-4xl font-normal font-display text-foreground leading-tight text-balance">
|
|
30
31
|
{heading}
|
|
31
32
|
</h1>
|
|
@@ -22,6 +22,8 @@ interface Props {
|
|
|
22
22
|
sameAs?: string[];
|
|
23
23
|
portrait?: ImageMetadata | string;
|
|
24
24
|
portraitAlt?: string;
|
|
25
|
+
/** `circle` crops the portrait round; the default keeps the rounded square. */
|
|
26
|
+
portraitShape?: 'square' | 'circle';
|
|
25
27
|
statsLine?: string;
|
|
26
28
|
totalItems?: number;
|
|
27
29
|
topicCount?: number;
|
|
@@ -51,6 +53,7 @@ const {
|
|
|
51
53
|
sameAs = [],
|
|
52
54
|
portrait,
|
|
53
55
|
portraitAlt,
|
|
56
|
+
portraitShape = 'square',
|
|
54
57
|
statsLine,
|
|
55
58
|
totalItems = 0,
|
|
56
59
|
topicCount = 0,
|
|
@@ -99,14 +102,14 @@ const hasWorksSlot = Astro.slots.has('works');
|
|
|
99
102
|
]}
|
|
100
103
|
>
|
|
101
104
|
{portrait && (
|
|
102
|
-
<div class="w-40 sm:w-48 md:w-full">
|
|
105
|
+
<div class="w-40 sm:w-48 md:w-full" data-author-portrait>
|
|
103
106
|
<ResponsiveImage
|
|
104
107
|
src={portrait}
|
|
105
108
|
alt={resolvedPortraitAlt}
|
|
106
109
|
width={400}
|
|
107
110
|
height={400}
|
|
108
111
|
sizes="(min-width: 1024px) 220px, (min-width: 640px) 192px, 160px"
|
|
109
|
-
class=
|
|
112
|
+
class={`aspect-square w-full ${portraitShape === 'circle' ? 'rounded-full' : 'rounded-xl'} object-cover bg-muted`}
|
|
110
113
|
loading="eager"
|
|
111
114
|
fetchpriority="high"
|
|
112
115
|
/>
|
|
@@ -127,7 +130,7 @@ const hasWorksSlot = Astro.slots.has('works');
|
|
|
127
130
|
</p>
|
|
128
131
|
|
|
129
132
|
{credentials && (
|
|
130
|
-
<div class="mt-6 max-w-measure rounded-xl border border-border bg-card/70 p-4">
|
|
133
|
+
<div class="mt-6 max-w-measure rounded-xl border border-border bg-card/70 p-4" data-author-credentials>
|
|
131
134
|
<p class="text-xs font-semibold uppercase tracking-[0.16em] text-primary mb-1.5">
|
|
132
135
|
{resolvedCredentialsHeading}
|
|
133
136
|
</p>
|
|
@@ -145,7 +148,7 @@ const hasWorksSlot = Astro.slots.has('works');
|
|
|
145
148
|
{expertise.map((topic) => {
|
|
146
149
|
const href = expertiseLinks?.[topic.toLowerCase()] ?? expertiseFallbackHref;
|
|
147
150
|
return href ? (
|
|
148
|
-
<Chip href={href} size="sm" text="sm" tone="outline">
|
|
151
|
+
<Chip href={href} size="sm" text="sm" tone="outline" data-author-chip>
|
|
149
152
|
{topic}
|
|
150
153
|
</Chip>
|
|
151
154
|
) : (
|
|
@@ -198,7 +201,7 @@ const hasWorksSlot = Astro.slots.has('works');
|
|
|
198
201
|
</p>
|
|
199
202
|
</div>
|
|
200
203
|
|
|
201
|
-
<ul class="divide-y divide-border rounded-xl border border-border bg-card overflow-hidden">
|
|
204
|
+
<ul class="divide-y divide-border rounded-xl border border-border bg-card overflow-hidden" data-author-work-list>
|
|
202
205
|
{workItems.map((item) => (
|
|
203
206
|
<li data-work-row>
|
|
204
207
|
<a
|
|
@@ -237,14 +240,14 @@ const hasWorksSlot = Astro.slots.has('works');
|
|
|
237
240
|
</div>
|
|
238
241
|
)}
|
|
239
242
|
|
|
240
|
-
{topicLinks.length >
|
|
243
|
+
{topicLinks.length > 1 && (
|
|
241
244
|
<div class="mt-10">
|
|
242
245
|
<p class="text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground mb-3">
|
|
243
246
|
{resolvedTopicsHeading}
|
|
244
247
|
</p>
|
|
245
248
|
<div class="flex flex-wrap gap-2">
|
|
246
249
|
{topicLinks.map((g) => (
|
|
247
|
-
<Chip href={g.href} tone="outline" size="md">
|
|
250
|
+
<Chip href={g.href} tone="outline" size="md" data-author-chip>
|
|
248
251
|
{g.label}
|
|
249
252
|
</Chip>
|
|
250
253
|
))}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Default English interlude labels for `Interlude.astro` (SLA-3720).
|
|
2
2
|
import type { InterludeLabels } from './interludes/types';
|
|
3
|
+
import { getLabels } from '../internal/labels';
|
|
3
4
|
|
|
4
5
|
export const DEFAULT_INTERLUDE_LABELS: InterludeLabels = {
|
|
5
6
|
answerBox: 'Quick Answer',
|
|
@@ -17,3 +18,8 @@ export const DEFAULT_INTERLUDE_LABELS: InterludeLabels = {
|
|
|
17
18
|
},
|
|
18
19
|
didYouKnow: 'Did You Know?',
|
|
19
20
|
};
|
|
21
|
+
|
|
22
|
+
/** The interlude labels of `locale`; English for an unknown one. */
|
|
23
|
+
export function getInterludeLabels(locale?: string): InterludeLabels {
|
|
24
|
+
return getLabels(locale).interludes;
|
|
25
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { monogram } from './monogram';
|
|
2
|
+
import { getLabels } from '../internal/labels';
|
|
2
3
|
|
|
3
4
|
export interface AuthorWorkItem {
|
|
4
5
|
title: string;
|
|
@@ -124,6 +125,12 @@ export const EDITORIAL_AUTHOR_WORK_CONFIG: readonly AuthorWorkGroupConfig[] = [
|
|
|
124
125
|
},
|
|
125
126
|
];
|
|
126
127
|
|
|
128
|
+
/** `EDITORIAL_AUTHOR_WORK_CONFIG` with the labels of `locale`; English for an unknown one. */
|
|
129
|
+
export function editorialAuthorWorkConfig(locale?: string): readonly AuthorWorkGroupConfig[] {
|
|
130
|
+
const { label, kind } = getLabels(locale).authorWork;
|
|
131
|
+
return [{ collection: 'articles', label, kind, listing: '/articles' }];
|
|
132
|
+
}
|
|
133
|
+
|
|
127
134
|
/**
|
|
128
135
|
* Generates an inline SVG data URI avatar with the author's monogram initials when no portrait asset exists,
|
|
129
136
|
* so `AuthorCard` and `AuthorsIndexPage` always receive a valid non-empty `photo` string (SLA-3721).
|
package/src/editorial/index.ts
CHANGED
|
@@ -74,6 +74,7 @@ export {
|
|
|
74
74
|
socialLinkLabel,
|
|
75
75
|
groupAuthorWork,
|
|
76
76
|
EDITORIAL_AUTHOR_WORK_CONFIG,
|
|
77
|
+
editorialAuthorWorkConfig,
|
|
77
78
|
authorPhotoDataUri,
|
|
78
79
|
type AuthorWorkItem,
|
|
79
80
|
type AuthorTopicLink,
|
|
@@ -96,6 +97,6 @@ export type {
|
|
|
96
97
|
ArticlePageSection,
|
|
97
98
|
ArticlePageData,
|
|
98
99
|
} from './ArticlePage.astro';
|
|
99
|
-
export { DEFAULT_INTERLUDE_LABELS } from './article-page';
|
|
100
|
+
export { DEFAULT_INTERLUDE_LABELS, getInterludeLabels } from './article-page';
|
|
100
101
|
export { default as EditorialHomePage } from './EditorialHomePage.astro';
|
|
101
102
|
export type { EditorialHomeAuthor } from './EditorialHomePage.astro';
|
|
@@ -21,7 +21,7 @@ const { headers, rows } = Astro.props;
|
|
|
21
21
|
{rows.map((row, i) => (
|
|
22
22
|
<tr class={i % 2 === 1 ? 'bg-muted/20' : ''}>
|
|
23
23
|
{row.map((cell) => (
|
|
24
|
-
<td class="px-4 py-3 text-muted-foreground leading-relaxed border-b border-border last:border-b-0 align-top" set:html={cell} />
|
|
24
|
+
<td class="px-4 py-3 text-muted-foreground leading-relaxed border-b border-border [tbody>tr:last-child>&]:border-b-0 align-top" set:html={cell} />
|
|
25
25
|
))}
|
|
26
26
|
</tr>
|
|
27
27
|
))}
|
package/src/internal/labels.ts
CHANGED
|
@@ -238,6 +238,15 @@ export const LABELS = {
|
|
|
238
238
|
emptyHeading: 'Nothing published yet',
|
|
239
239
|
emptyBody: (name: string) => `${name}'s work will appear here as pieces go live across the site.`,
|
|
240
240
|
},
|
|
241
|
+
interludes: {
|
|
242
|
+
answerBox: 'Quick Answer',
|
|
243
|
+
evidence: { title: 'Evidence & Context', finding: 'Finding', basis: 'Basis', boundary: 'Boundary' },
|
|
244
|
+
fieldNote: 'From the Desk',
|
|
245
|
+
timeline: 'Timeline',
|
|
246
|
+
tldr: { bullets: 'Key Takeaways', prose: 'In Short' },
|
|
247
|
+
didYouKnow: 'Did You Know?',
|
|
248
|
+
},
|
|
249
|
+
authorWork: { label: 'Articles', kind: 'Article' },
|
|
241
250
|
authorsIndexPage: {
|
|
242
251
|
eyebrow: 'Named Contributors',
|
|
243
252
|
heading: 'Editorial Team',
|
|
@@ -485,6 +494,15 @@ export const LABELS_IT: typeof LABELS = {
|
|
|
485
494
|
emptyHeading: 'Nessun contenuto ancora pubblicato',
|
|
486
495
|
emptyBody: (name: string) => `I contenuti di ${name} appariranno qui non appena saranno pubblicati sul sito.`,
|
|
487
496
|
},
|
|
497
|
+
interludes: {
|
|
498
|
+
answerBox: 'Risposta rapida',
|
|
499
|
+
evidence: { title: 'Prove e contesto', finding: 'Evidenza', basis: 'Base', boundary: 'Limite' },
|
|
500
|
+
fieldNote: 'Dalla redazione',
|
|
501
|
+
timeline: 'Cronologia',
|
|
502
|
+
tldr: { bullets: 'In sintesi', prose: 'In breve' },
|
|
503
|
+
didYouKnow: 'Lo sapevi?',
|
|
504
|
+
},
|
|
505
|
+
authorWork: { label: 'Articoli', kind: 'Articolo' },
|
|
488
506
|
authorsIndexPage: {
|
|
489
507
|
eyebrow: 'Contributori nominali',
|
|
490
508
|
heading: 'Redazione',
|
|
@@ -25,6 +25,13 @@ interface Props {
|
|
|
25
25
|
/** Per-theme gradient classes layered over the built-in map, for a site whose theme looks differ. */
|
|
26
26
|
themeGradients?: Record<string, string>;
|
|
27
27
|
overlay?: 'themed' | 'editorial';
|
|
28
|
+
/**
|
|
29
|
+
* `overlay` (default) puts the title over the photo. `split` is a solid band with the text left and the photo right
|
|
30
|
+
* (`mediaShape` crops it round); `rail` puts the info and actions slots in a left rail beside the headline, the
|
|
31
|
+
* photo full width below. `split` and `rail` ignore `theme`, `overlay` and `decoration`.
|
|
32
|
+
*/
|
|
33
|
+
variant?: 'overlay' | 'split' | 'rail';
|
|
34
|
+
mediaShape?: 'rect' | 'circle';
|
|
28
35
|
minHeight?: 'short' | 'medium' | 'tall';
|
|
29
36
|
class?: string;
|
|
30
37
|
}
|
|
@@ -41,6 +48,8 @@ const {
|
|
|
41
48
|
theme = 'dark',
|
|
42
49
|
themeGradients: themeOverrides,
|
|
43
50
|
overlay = 'themed',
|
|
51
|
+
variant = 'overlay',
|
|
52
|
+
mediaShape = 'rect',
|
|
44
53
|
minHeight = 'medium',
|
|
45
54
|
class: className,
|
|
46
55
|
} = Astro.props;
|
|
@@ -75,8 +84,8 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
75
84
|
);
|
|
76
85
|
---
|
|
77
86
|
|
|
78
|
-
<section class:list={['relative flex items-end overflow-hidden', heightClass, className]}>
|
|
79
|
-
<div class="absolute inset-0 overflow-hidden">
|
|
87
|
+
{variant === 'overlay' && (<section data-hero class:list={['relative flex items-end overflow-hidden', heightClass, className]}>
|
|
88
|
+
<div class="absolute inset-0 overflow-hidden" data-hero-media>
|
|
80
89
|
{image ? (
|
|
81
90
|
<ResponsivePicture
|
|
82
91
|
src={image}
|
|
@@ -138,6 +147,7 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
138
147
|
{badges && <div class="flex flex-wrap gap-2 mb-4" set:html={badges} />}
|
|
139
148
|
|
|
140
149
|
<h1
|
|
150
|
+
data-hero-title
|
|
141
151
|
class:list={[
|
|
142
152
|
'font-medium text-overlay-foreground leading-[1.08] mb-4 font-display',
|
|
143
153
|
overlay === 'editorial'
|
|
@@ -167,4 +177,57 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
167
177
|
</div>
|
|
168
178
|
</div>
|
|
169
179
|
</div>
|
|
170
|
-
</section>
|
|
180
|
+
</section>)}
|
|
181
|
+
|
|
182
|
+
{variant !== 'overlay' && (
|
|
183
|
+
<section data-hero data-hero-variant={variant} class:list={['relative overflow-hidden', variant === 'split' ? 'bg-overlay text-overlay-foreground' : 'bg-background text-foreground', className]}>
|
|
184
|
+
<div class="mx-auto max-w-shell px-4 sm:px-6 lg:px-8 py-10 lg:py-14">
|
|
185
|
+
<div class:list={['grid gap-8 lg:gap-12 items-center', variant === 'split' ? 'lg:grid-cols-[1fr_minmax(0,26rem)]' : 'lg:grid-cols-[15rem_1fr] lg:items-start']}>
|
|
186
|
+
{variant === 'rail' && (info || actions) && (
|
|
187
|
+
<div class="order-2 lg:order-1 flex flex-col gap-4 lg:border-r lg:border-border lg:pr-8" data-hero-rail>
|
|
188
|
+
{info && <div set:html={info} />}
|
|
189
|
+
{actions && <div class="flex flex-wrap gap-3" set:html={actions} />}
|
|
190
|
+
</div>
|
|
191
|
+
)}
|
|
192
|
+
<div class:list={['min-w-0', variant === 'rail' && 'order-1 lg:order-2']}>
|
|
193
|
+
{badges && <div class="flex flex-wrap gap-2 mb-4" set:html={badges} />}
|
|
194
|
+
<h1 data-hero-title class="font-display font-medium leading-[1.02] mb-4 text-[2rem] sm:text-5xl lg:text-6xl text-balance">{title}</h1>
|
|
195
|
+
{subtitle && <div class="mb-4" set:html={subtitle} />}
|
|
196
|
+
{description && <p class="text-lg leading-relaxed max-w-deck opacity-85">{description}</p>}
|
|
197
|
+
{variant === 'split' && info && <div class="mt-6 flex flex-wrap gap-3" set:html={info} />}
|
|
198
|
+
{variant === 'split' && actions && <div class="mt-5 flex flex-wrap gap-3" set:html={actions} />}
|
|
199
|
+
</div>
|
|
200
|
+
{variant === 'split' && image && (
|
|
201
|
+
<div data-hero-media class:list={['relative mx-auto w-full max-w-[26rem] aspect-square overflow-hidden bg-primary', mediaShape === 'circle' && 'rounded-full']}>
|
|
202
|
+
<ResponsivePicture
|
|
203
|
+
src={image}
|
|
204
|
+
alt={imageAlt}
|
|
205
|
+
title={imageTitle}
|
|
206
|
+
sizes="(max-width: 1024px) 80vw, 26rem"
|
|
207
|
+
quality={70}
|
|
208
|
+
class="w-full h-full object-cover"
|
|
209
|
+
pictureAttributes={{ class: 'block w-full h-full' }}
|
|
210
|
+
loading="eager"
|
|
211
|
+
fetchpriority="high"
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
{variant === 'rail' && image && (
|
|
217
|
+
<div data-hero-media class:list={['mt-10 aspect-[16/9] lg:aspect-[21/9] overflow-hidden bg-muted', mediaShape === 'circle' && 'rounded-[2rem]']}>
|
|
218
|
+
<ResponsivePicture
|
|
219
|
+
src={image}
|
|
220
|
+
alt={imageAlt}
|
|
221
|
+
title={imageTitle}
|
|
222
|
+
sizes="(max-width: 1280px) 100vw, 1280px"
|
|
223
|
+
quality={70}
|
|
224
|
+
class="w-full h-full object-cover"
|
|
225
|
+
pictureAttributes={{ class: 'block w-full h-full' }}
|
|
226
|
+
loading="eager"
|
|
227
|
+
fetchpriority="high"
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
)}
|
|
231
|
+
</div>
|
|
232
|
+
</section>
|
|
233
|
+
)}
|
|
@@ -33,6 +33,8 @@ interface Props {
|
|
|
33
33
|
/** Optional Xataka-style secondary "Trending Topics" horizontal sub-bar rendered under the main nav row. */
|
|
34
34
|
trendingTags?: readonly TrendingTopicLink[];
|
|
35
35
|
trendingLabel?: string;
|
|
36
|
+
/** Viewport width from which the inline nav replaces the hamburger: `lg` (1024px, default) or `xl` (1280px). */
|
|
37
|
+
desktopBreakpoint?: 'lg' | 'xl';
|
|
36
38
|
locale?: string;
|
|
37
39
|
id?: string;
|
|
38
40
|
panelId?: string;
|
|
@@ -51,10 +53,12 @@ const {
|
|
|
51
53
|
searchPath,
|
|
52
54
|
trendingTags = [],
|
|
53
55
|
trendingLabel = defaultLabels.trendingLabel,
|
|
56
|
+
desktopBreakpoint = 'lg',
|
|
54
57
|
id = 'main-nav',
|
|
55
58
|
panelId = 'mobile-menu',
|
|
56
59
|
toggleId = 'mobile-menu-btn',
|
|
57
60
|
} = Astro.props;
|
|
61
|
+
const xl = desktopBreakpoint === 'xl';
|
|
58
62
|
---
|
|
59
63
|
|
|
60
64
|
<header
|
|
@@ -67,11 +71,11 @@ const {
|
|
|
67
71
|
<nav class="mx-auto max-w-shell px-4 sm:px-6 lg:px-8" aria-label={label}>
|
|
68
72
|
<div class="flex h-16 items-center justify-between">
|
|
69
73
|
<slot name="logo" />
|
|
70
|
-
<div class=
|
|
74
|
+
<div class={xl ? 'hidden xl:flex items-center gap-1' : 'hidden lg:flex items-center gap-1'}>
|
|
71
75
|
<slot name="desktop" />
|
|
72
76
|
</div>
|
|
73
77
|
<slot name="actions" />
|
|
74
|
-
<div class=
|
|
78
|
+
<div class={xl ? 'xl:hidden flex items-center gap-1' : 'lg:hidden flex items-center gap-1'}>
|
|
75
79
|
<slot name="mobile-actions" />
|
|
76
80
|
<button
|
|
77
81
|
type="button"
|
|
@@ -108,7 +112,7 @@ const {
|
|
|
108
112
|
)}
|
|
109
113
|
</header>
|
|
110
114
|
|
|
111
|
-
<div id={panelId} class:list={['lg:hidden hidden fixed inset-x-0 top-16 bottom-0 z-50 overflow-y-auto overscroll-contain', surfaceClass]} data-pagefind-ignore>
|
|
115
|
+
<div id={panelId} class:list={[xl ? 'xl:hidden' : 'lg:hidden', 'hidden fixed inset-x-0 top-16 bottom-0 z-50 overflow-y-auto overscroll-contain', surfaceClass]} data-pagefind-ignore>
|
|
112
116
|
<div class="flex flex-col pt-2 pb-12 border-t border-border relative">
|
|
113
117
|
<slot name="mobile" />
|
|
114
118
|
</div>
|
|
@@ -41,6 +41,8 @@ interface Props {
|
|
|
41
41
|
updatedIconClass?: string;
|
|
42
42
|
/** Whitespace compatibility only: 'grouped' compiles to the markup of a template that wraps the byline in a Fragment. */
|
|
43
43
|
bylineWhitespace?: 'flat' | 'grouped';
|
|
44
|
+
/** Print the freshness dates (default); a site that shows them elsewhere passes false. */
|
|
45
|
+
showDates?: boolean;
|
|
44
46
|
/** With an era, its chip sits beside the byline. */
|
|
45
47
|
era?: EraDefinition;
|
|
46
48
|
/** Base path of the chronology page the era chip links to. */
|
|
@@ -63,6 +65,7 @@ const {
|
|
|
63
65
|
placeholderClass = 'bg-gradient-to-br from-primary/20 to-accent/20',
|
|
64
66
|
updatedIconClass = 'text-primary',
|
|
65
67
|
bylineWhitespace = 'flat',
|
|
68
|
+
showDates = true,
|
|
66
69
|
era,
|
|
67
70
|
eraBasePath,
|
|
68
71
|
} = Astro.props;
|
|
@@ -100,6 +103,7 @@ const bylineLead = author ? (grouped ? ' ' : ' ') : (grouped ? '' : ' ');
|
|
|
100
103
|
width={96}
|
|
101
104
|
height={96}
|
|
102
105
|
class="w-12 h-12 rounded-full object-cover bg-muted shrink-0 mt-0.5"
|
|
106
|
+
data-byline-avatar
|
|
103
107
|
loading="lazy"
|
|
104
108
|
decoding="async"
|
|
105
109
|
/>
|
|
@@ -110,11 +114,12 @@ const bylineLead = author ? (grouped ? ' ' : ' ') : (grouped ? '' : ' ');
|
|
|
110
114
|
width="48"
|
|
111
115
|
height="48"
|
|
112
116
|
class="w-12 h-12 rounded-full object-cover bg-muted shrink-0 mt-0.5"
|
|
117
|
+
data-byline-avatar
|
|
113
118
|
loading="lazy"
|
|
114
119
|
decoding="async"
|
|
115
120
|
/>
|
|
116
121
|
) : (
|
|
117
|
-
<div class:list={['w-12 h-12 rounded-full', placeholderClass, 'shrink-0 mt-0.5']} aria-hidden="true" />
|
|
122
|
+
<div class:list={['w-12 h-12 rounded-full', placeholderClass, 'shrink-0 mt-0.5']} data-byline-avatar aria-hidden="true" />
|
|
118
123
|
))}
|
|
119
124
|
|
|
120
125
|
{/* name, credentials, dates */}
|
|
@@ -159,7 +164,7 @@ const bylineLead = author ? (grouped ? ' ' : ' ') : (grouped ? '' : ' ');
|
|
|
159
164
|
</details>
|
|
160
165
|
)}
|
|
161
166
|
{/* freshness first */}
|
|
162
|
-
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
|
|
167
|
+
{showDates && <div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
|
|
163
168
|
{showModified && modifiedFormatted ? (
|
|
164
169
|
<span class="inline-flex items-center gap-1.5 text-sm font-medium text-foreground">
|
|
165
170
|
<svg class:list={['w-3.5 h-3.5 shrink-0', updatedIconClass]} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
@@ -174,7 +179,7 @@ const bylineLead = author ? (grouped ? ' ' : ' ') : (grouped ? '' : ' ');
|
|
|
174
179
|
{showModified && publishedFormatted && (
|
|
175
180
|
<span class="inline-flex items-center gap-x-3"><span aria-hidden="true">·</span><span>{publishedLabel} <time datetime={datePublished}>{publishedFormatted}</time></span></span>
|
|
176
181
|
)}
|
|
177
|
-
</div>
|
|
182
|
+
</div>}
|
|
178
183
|
</div>
|
|
179
184
|
</div>
|
|
180
185
|
</address>
|