@sarimarcus/content-sites-ui 0.57.0 → 0.58.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 +28 -0
- package/package.json +2 -2
- package/src/composed/TableOfContents.astro +20 -4
- 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 +120 -21
- 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 +77 -5
- package/src/navigation/SiteHeader.astro +7 -3
- package/src/seo/ArticleMetadata.astro +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.58.0 (2026-11-05)
|
|
6
|
+
|
|
7
|
+
Opt-in editorial article head (SLA-3889). Defaults keep today's markup: `render-diff` against 0.57.1 is byte-identical for `ArticlePage` (no hero and the default head), `ContentHero` `rail` and `TableOfContents` `card` and `plain`.
|
|
8
|
+
|
|
9
|
+
- `ArticlePage`: `headVariant` (`standard` default | `editorial`). `editorial` is a Verge-style reading layout: the `rail` hero (byline and share in a left rail, category chip, headline, deck, photo with caption), a "back" link replacing the breadcrumb below `sm`, the lede without its left rule and with the drop cap on, near-black `text-lg sm:text-xl` body paragraphs, and the section list in a sticky side column from 1360px (below that the card ToC stays). New `categoryChip` (`{ label, href? }`) and `rail` slot (extra rail content under the byline); `article.imageCaption` is the photo caption. The headline scale reads `--article-title-size`, `--article-title-size-sm` and `--article-title-size-lg` (defaults 1.875, 2.5 and 3rem).
|
|
10
|
+
- `ContentHero`: `caption` slot (`rail` only, rendered under the photo as `data-hero-caption`), `titleClass`, `mediaClass` and `compact` (`rail` only: replace the headline size classes, replace the photo's aspect-ratio classes, tighter vertical rhythm).
|
|
11
|
+
- `TableOfContents`: `variant="margin"`, a vertical list of section links (`data-section-link`, so the scroll-spy marks the section in view) with no mini bar and no mobile disclosure.
|
|
12
|
+
|
|
13
|
+
## 0.57.1 (2026-11-05)
|
|
14
|
+
|
|
15
|
+
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".
|
|
16
|
+
|
|
17
|
+
- `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`.
|
|
18
|
+
- `ArticlesListingPage`, `ArticleTopicPage`: `eyebrow` is optional (no kicker when absent). `ArticleTagPage`: `eyebrow={false}` omits it; new `relatedTagsLimit` and `showRelatedTags`.
|
|
19
|
+
- `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.
|
|
20
|
+
- `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`.
|
|
21
|
+
- `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.
|
|
22
|
+
- `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.
|
|
23
|
+
- `editorial`: `editorialAuthorWorkConfig(locale)` and `getInterludeLabels(locale)` (English and Italian); the English exports are unchanged.
|
|
24
|
+
|
|
25
|
+
### Output changes
|
|
26
|
+
|
|
27
|
+
- 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).
|
|
28
|
+
- The idle `TableOfContents` mini bar is `invisible` as well as translated out, so no sliver shows under the fixed header.
|
|
29
|
+
- `ComparisonTable`: the last row, not the last cell of every row, drops its bottom border.
|
|
30
|
+
- `AuthorPage`: the "explore by topic" chips render only when there are two or more groups.
|
|
31
|
+
- Listing and tag page headers differ in whitespace only.
|
|
32
|
+
|
|
5
33
|
## 0.57.0 (2026-11-05)
|
|
6
34
|
|
|
7
35
|
- `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.
|
|
3
|
+
"version": "0.58.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",
|
|
@@ -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.
|
|
54
|
+
"@sarimarcus/content-sites-core": "0.58.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -26,7 +26,8 @@ interface Props {
|
|
|
26
26
|
eyebrowClass?: string;
|
|
27
27
|
/** Extra classes on the header block (e.g. `max-md:hidden` for a desktop-only heading). */
|
|
28
28
|
headerClass?: string;
|
|
29
|
-
|
|
29
|
+
/** `margin`: a vertical list of section links with no mini bar or mobile disclosure, for a sticky side column. */
|
|
30
|
+
variant?: 'card' | 'plain' | 'margin';
|
|
30
31
|
showHeader?: boolean;
|
|
31
32
|
navClass?: string;
|
|
32
33
|
linkClass?: string;
|
|
@@ -77,7 +78,7 @@ const showMini = variant === 'card';
|
|
|
77
78
|
data-toc-mini
|
|
78
79
|
data-toc
|
|
79
80
|
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"
|
|
81
|
+
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
82
|
aria-hidden="true"
|
|
82
83
|
inert
|
|
83
84
|
>
|
|
@@ -102,7 +103,22 @@ const showMini = variant === 'card';
|
|
|
102
103
|
</div>
|
|
103
104
|
)}
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
{variant === 'margin' ? (
|
|
107
|
+
<section data-toc data-toc-section-selector={sectionSelector} class:list={[className]}>
|
|
108
|
+
{eyebrow && <p class:list={['mb-3 text-xs font-medium uppercase tracking-[0.2em]', eyebrowClass]}>{eyebrow}</p>}
|
|
109
|
+
<nav aria-label={ariaLabel} class:list={['flex flex-col border-l border-border', navClassName]}>
|
|
110
|
+
{items.map((item) => (
|
|
111
|
+
<a
|
|
112
|
+
href={item.href}
|
|
113
|
+
data-section-link={resolveSectionId(item)}
|
|
114
|
+
class:list={['-ml-px border-l-2 border-transparent py-1.5 pl-4 pr-2 text-sm leading-snug text-muted-foreground transition-colors hover:text-foreground data-[active=true]:border-primary data-[active=true]:font-medium data-[active=true]:text-foreground', linkClassName]}
|
|
115
|
+
>
|
|
116
|
+
{item.label}
|
|
117
|
+
</a>
|
|
118
|
+
))}
|
|
119
|
+
</nav>
|
|
120
|
+
</section>
|
|
121
|
+
) : (<section
|
|
106
122
|
data-toc
|
|
107
123
|
data-toc-section-selector={sectionSelector}
|
|
108
124
|
{...(showMini ? { 'data-toc-main': '' } : {})}
|
|
@@ -153,7 +169,7 @@ const showMini = variant === 'card';
|
|
|
153
169
|
</Chip>
|
|
154
170
|
))}
|
|
155
171
|
</nav>
|
|
156
|
-
</section>
|
|
172
|
+
</section>)}
|
|
157
173
|
|
|
158
174
|
<script>
|
|
159
175
|
import { initTableOfContents } from './toc.ts';
|
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
|
)}
|
|
@@ -23,6 +23,7 @@ import InlineImage from '../composed/InlineImage.astro';
|
|
|
23
23
|
import RelatedContent from '../composed/RelatedContent.astro';
|
|
24
24
|
import type { RelatedItem } from '../composed/related';
|
|
25
25
|
import Chip from '../primitives/Chip.astro';
|
|
26
|
+
import Badge from '../primitives/Badge.astro';
|
|
26
27
|
import { trustedHtml } from '../types';
|
|
27
28
|
import { getLabels } from '../internal/labels';
|
|
28
29
|
import ArticleKeyFacts from './ArticleKeyFacts.astro';
|
|
@@ -67,6 +68,8 @@ export interface ArticlePageData {
|
|
|
67
68
|
intro: string;
|
|
68
69
|
imageAlt: string;
|
|
69
70
|
imageTitle?: string;
|
|
71
|
+
/** One line under the hero photo (inline markdown); shown by `headVariant="editorial"`. */
|
|
72
|
+
imageCaption?: string;
|
|
70
73
|
author?: string;
|
|
71
74
|
datePublished?: string;
|
|
72
75
|
dateModified?: string;
|
|
@@ -99,6 +102,26 @@ interface Props {
|
|
|
99
102
|
/** Render ShareButtons below byline and at end of article body (SLA-3718). */
|
|
100
103
|
shareUrl?: string;
|
|
101
104
|
showShareButtons?: boolean;
|
|
105
|
+
/** With `showShareButtons`, show the bar under the byline (default) and/or after the body (default). */
|
|
106
|
+
showShareTop?: boolean;
|
|
107
|
+
showShareBottom?: boolean;
|
|
108
|
+
/** Print the dates in the byline (default). */
|
|
109
|
+
showDates?: boolean;
|
|
110
|
+
/** Article head: the photo-behind-title `overlay` (default), a solid `split` band, or a `rail` of byline and share beside the headline. */
|
|
111
|
+
heroVariant?: 'overlay' | 'split' | 'rail';
|
|
112
|
+
heroMediaShape?: 'rect' | 'circle';
|
|
113
|
+
/**
|
|
114
|
+
* `editorial`: a Verge-style reading layout. A rail head (category chip, headline, deck and photo with caption; byline
|
|
115
|
+
* and share in the left rail), a "← back" link replacing the breadcrumb on mobile, a larger near-black body with the
|
|
116
|
+
* drop cap on, and the section list in a sticky side column from 1360px. Implies the `rail` hero, which needs a hero
|
|
117
|
+
* image: without one the page falls back to the plain no-hero head and `categoryChip` and the caption do not render.
|
|
118
|
+
* The default `standard` changes nothing.
|
|
119
|
+
*/
|
|
120
|
+
headVariant?: 'standard' | 'editorial';
|
|
121
|
+
/** `editorial`: the chip above the headline, a link when `href` is set. */
|
|
122
|
+
categoryChip?: { label: string; href?: string };
|
|
123
|
+
/** Replaces the breadcrumb band's classes; keep its top padding to clear the fixed header. */
|
|
124
|
+
breadcrumbBandClass?: string;
|
|
102
125
|
/** Enable decorative drop-cap on the lede paragraph when it starts with a letter/quote. */
|
|
103
126
|
dropCap?: boolean;
|
|
104
127
|
/** Emit hidden sr-only audience spans for Pagefind facet filtering. */
|
|
@@ -159,6 +182,14 @@ const {
|
|
|
159
182
|
routes = {},
|
|
160
183
|
shareUrl,
|
|
161
184
|
showShareButtons = false,
|
|
185
|
+
showShareTop = true,
|
|
186
|
+
showShareBottom = true,
|
|
187
|
+
showDates = true,
|
|
188
|
+
heroVariant = 'overlay',
|
|
189
|
+
heroMediaShape = 'rect',
|
|
190
|
+
headVariant = 'standard',
|
|
191
|
+
categoryChip,
|
|
192
|
+
breadcrumbBandClass,
|
|
162
193
|
dropCap = false,
|
|
163
194
|
emitAudienceFacets = false,
|
|
164
195
|
noHeroEyebrow,
|
|
@@ -179,12 +210,26 @@ const {
|
|
|
179
210
|
relatedProps = {},
|
|
180
211
|
backLink = null,
|
|
181
212
|
} = Astro.props;
|
|
213
|
+
const editorial = headVariant === 'editorial';
|
|
214
|
+
const railHead = (heroVariant === 'rail' || editorial) && !!heroImage;
|
|
182
215
|
|
|
183
216
|
const l = getLabels(locale).articlePage;
|
|
184
217
|
const sourcesLen = article.sources?.length ?? 0;
|
|
185
218
|
const md = (text: string) => trustedHtml(renderInlineMarkdown(text, basePath, sourcesLen));
|
|
186
219
|
const introHtml = parseMarkdownInline(article.intro, basePath, sourcesLen);
|
|
187
|
-
const hasDropCap = dropCap && /^["'«“‘]?[A-Za-zÀ-ÖØ-öø-ÿ]/.test(article.intro.trimStart());
|
|
220
|
+
const hasDropCap = (dropCap || editorial) && /^["'«“‘]?[A-Za-zÀ-ÖØ-öø-ÿ]/.test(article.intro.trimStart());
|
|
221
|
+
const ledeClass = editorial
|
|
222
|
+
? 'article-lede text-foreground mb-8 font-normal'
|
|
223
|
+
: 'article-lede text-foreground/90 mb-8 font-normal border-l-2 border-primary/40 pl-5';
|
|
224
|
+
const paragraphClass = editorial
|
|
225
|
+
? 'text-lg sm:text-xl text-foreground leading-[1.65] mb-5'
|
|
226
|
+
: 'text-base text-muted-foreground leading-relaxed mb-4';
|
|
227
|
+
const subParagraphClass = editorial
|
|
228
|
+
? 'text-lg sm:text-xl text-foreground leading-[1.65] mb-4'
|
|
229
|
+
: 'text-base text-muted-foreground leading-relaxed mb-3';
|
|
230
|
+
const headTitleClass =
|
|
231
|
+
'text-[length:var(--article-title-size,1.875rem)] sm:text-[length:var(--article-title-size-sm,2.5rem)] lg:text-[length:var(--article-title-size-lg,3rem)] text-balance';
|
|
232
|
+
const headMediaClass = 'aspect-[16/9]';
|
|
188
233
|
|
|
189
234
|
const tocItems = article.sections.map((s) => ({
|
|
190
235
|
label: s.heading,
|
|
@@ -289,20 +334,67 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
289
334
|
<span class="sr-only" data-pagefind-filter={`audience:${a}`}>{a}</span>
|
|
290
335
|
))}
|
|
291
336
|
|
|
292
|
-
|
|
337
|
+
{editorial && backLink ? (
|
|
338
|
+
<BreadcrumbBand class={breadcrumbBandClass}>
|
|
339
|
+
<a href={backLink.href} data-article-back class="inline-flex items-center gap-2 py-1 text-sm font-medium text-muted-foreground hover:text-primary sm:hidden">
|
|
340
|
+
<span aria-hidden="true">←</span>
|
|
341
|
+
<span>{backLink.label ?? l.allArticlesLabel}</span>
|
|
342
|
+
</a>
|
|
343
|
+
<div class="hidden sm:block"><Breadcrumb items={breadcrumbs} {...breadcrumbProps} /></div>
|
|
344
|
+
</BreadcrumbBand>
|
|
345
|
+
) : (
|
|
346
|
+
<BreadcrumbBand class={breadcrumbBandClass}>
|
|
293
347
|
<Breadcrumb items={breadcrumbs} {...breadcrumbProps} />
|
|
294
348
|
</BreadcrumbBand>
|
|
349
|
+
)}
|
|
295
350
|
|
|
296
351
|
{heroImage ? (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
352
|
+
railHead ? (
|
|
353
|
+
<ContentHero
|
|
354
|
+
title={article.title}
|
|
355
|
+
description={article.description}
|
|
356
|
+
image={heroImage}
|
|
357
|
+
imageAlt={article.imageAlt}
|
|
358
|
+
imageTitle={article.imageTitle}
|
|
359
|
+
variant="rail"
|
|
360
|
+
mediaShape={heroMediaShape}
|
|
361
|
+
titleClass={editorial ? headTitleClass : undefined}
|
|
362
|
+
mediaClass={editorial ? headMediaClass : undefined}
|
|
363
|
+
compact={editorial}
|
|
364
|
+
>
|
|
365
|
+
{editorial && categoryChip && (
|
|
366
|
+
<Fragment slot="badges">{categoryChip.href ? (
|
|
367
|
+
<Chip href={categoryChip.href} size="sm" tone="outlineQuiet">{categoryChip.label}</Chip>
|
|
368
|
+
) : (
|
|
369
|
+
<Badge tone="primary" size="sm" lines={1}>{categoryChip.label}</Badge>
|
|
370
|
+
)}</Fragment>
|
|
371
|
+
)}
|
|
372
|
+
{editorial && article.imageCaption && <Fragment slot="caption" set:html={md(article.imageCaption)} />}
|
|
373
|
+
<Fragment slot="info"><ArticleMetadata
|
|
374
|
+
author={author}
|
|
375
|
+
datePublished={article.datePublished}
|
|
376
|
+
dateModified={article.dateModified}
|
|
377
|
+
timeZone={timeZone}
|
|
378
|
+
locale={locale}
|
|
379
|
+
showDates={showDates}
|
|
380
|
+
era={era}
|
|
381
|
+
eraBasePath={eraBasePath}
|
|
382
|
+
/><slot name="rail" /></Fragment>
|
|
383
|
+
<Fragment slot="actions">{showShareButtons && shareUrl && showShareTop && <ShareButtons url={shareUrl} title={article.title} locale={locale} />}</Fragment>
|
|
384
|
+
</ContentHero>
|
|
385
|
+
) : (
|
|
386
|
+
<ContentHero
|
|
387
|
+
title={article.title}
|
|
388
|
+
description={article.description}
|
|
389
|
+
image={heroImage}
|
|
390
|
+
imageAlt={article.imageAlt}
|
|
391
|
+
imageTitle={article.imageTitle}
|
|
392
|
+
overlay="editorial"
|
|
393
|
+
minHeight="short"
|
|
394
|
+
variant={heroVariant}
|
|
395
|
+
mediaShape={heroMediaShape}
|
|
396
|
+
/>
|
|
397
|
+
)
|
|
306
398
|
) : (
|
|
307
399
|
<header class="pt-10 pb-6 border-b border-border">
|
|
308
400
|
<Container size="measure">
|
|
@@ -316,18 +408,19 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
316
408
|
)}
|
|
317
409
|
|
|
318
410
|
<main>
|
|
319
|
-
<Container size="measure" class=
|
|
320
|
-
<ArticleMetadata
|
|
411
|
+
<Container size="measure" class={editorial ? 'relative pt-6 pb-10 sm:pt-8 sm:pb-14' : 'py-10 sm:py-14'}>
|
|
412
|
+
{!railHead && <ArticleMetadata
|
|
321
413
|
author={author}
|
|
322
414
|
datePublished={article.datePublished}
|
|
323
415
|
dateModified={article.dateModified}
|
|
324
416
|
timeZone={timeZone}
|
|
325
417
|
locale={locale}
|
|
418
|
+
showDates={showDates}
|
|
326
419
|
era={era}
|
|
327
420
|
eraBasePath={eraBasePath}
|
|
328
|
-
/>
|
|
421
|
+
/>}
|
|
329
422
|
|
|
330
|
-
{showShareButtons && shareUrl && (
|
|
423
|
+
{showShareButtons && shareUrl && showShareTop && !railHead && (
|
|
331
424
|
<div class="mb-6">
|
|
332
425
|
<ShareButtons url={shareUrl} title={article.title} locale={locale} />
|
|
333
426
|
</div>
|
|
@@ -336,7 +429,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
336
429
|
<slot name="after-byline" />
|
|
337
430
|
|
|
338
431
|
<div
|
|
339
|
-
class=
|
|
432
|
+
class={ledeClass}
|
|
340
433
|
data-dropcap={hasDropCap ? '' : undefined}
|
|
341
434
|
set:html={introHtml}
|
|
342
435
|
/>
|
|
@@ -352,9 +445,15 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
352
445
|
)}
|
|
353
446
|
|
|
354
447
|
{showToc && (
|
|
355
|
-
<div class=
|
|
448
|
+
<Fragment><div class={editorial ? 'mb-10 min-[1360px]:hidden' : 'mb-10'} data-pagefind-ignore>
|
|
356
449
|
<TableOfContents items={tocItems} eyebrow={l.tocEyebrow} headerClass="max-md:hidden" {...tocProps} />
|
|
357
|
-
</div>
|
|
450
|
+
</div>{editorial && (
|
|
451
|
+
<aside class="absolute left-full top-0 bottom-0 ml-10 hidden w-52 min-[1360px]:block" data-article-toc-margin data-pagefind-ignore>
|
|
452
|
+
<div class="sticky top-28">
|
|
453
|
+
<TableOfContents variant="margin" items={tocItems} eyebrow={l.tocEyebrow} ariaLabel={l.tocEyebrow} />
|
|
454
|
+
</div>
|
|
455
|
+
</aside>
|
|
456
|
+
)}</Fragment>
|
|
358
457
|
)}
|
|
359
458
|
|
|
360
459
|
<div class={proseClass}>
|
|
@@ -372,7 +471,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
372
471
|
</h2>
|
|
373
472
|
{blocks.map((block) => {
|
|
374
473
|
if (block.kind === 'paragraph') {
|
|
375
|
-
return <div class=
|
|
474
|
+
return <div class={paragraphClass} set:html={block.html} />;
|
|
376
475
|
}
|
|
377
476
|
if (block.kind === 'interlude') {
|
|
378
477
|
return (
|
|
@@ -422,7 +521,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
422
521
|
{sub.heading}
|
|
423
522
|
</h3>
|
|
424
523
|
{sub.paragraphs.map((pHtml) => (
|
|
425
|
-
<div class=
|
|
524
|
+
<div class={subParagraphClass} set:html={pHtml} />
|
|
426
525
|
))}
|
|
427
526
|
</div>
|
|
428
527
|
))}
|
|
@@ -455,7 +554,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
455
554
|
</nav>
|
|
456
555
|
)}
|
|
457
556
|
|
|
458
|
-
{showShareButtons && shareUrl && (
|
|
557
|
+
{showShareButtons && shareUrl && showShareBottom && (
|
|
459
558
|
<div class="mt-8 pt-6 border-t border-border" data-pagefind-ignore>
|
|
460
559
|
<ShareButtons url={shareUrl} title={article.title} locale={locale} />
|
|
461
560
|
</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,7 +25,20 @@ 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';
|
|
36
|
+
/** `rail` only: replaces the headline's size classes (a site's own scale). */
|
|
37
|
+
titleClass?: string;
|
|
38
|
+
/** `rail` only: replaces the photo's aspect-ratio classes. */
|
|
39
|
+
mediaClass?: string;
|
|
40
|
+
/** `rail` only: tighter vertical rhythm, so the headline fits the first mobile screen. */
|
|
41
|
+
compact?: boolean;
|
|
29
42
|
class?: string;
|
|
30
43
|
}
|
|
31
44
|
|
|
@@ -41,7 +54,12 @@ const {
|
|
|
41
54
|
theme = 'dark',
|
|
42
55
|
themeGradients: themeOverrides,
|
|
43
56
|
overlay = 'themed',
|
|
57
|
+
variant = 'overlay',
|
|
58
|
+
mediaShape = 'rect',
|
|
44
59
|
minHeight = 'medium',
|
|
60
|
+
titleClass,
|
|
61
|
+
mediaClass,
|
|
62
|
+
compact = false,
|
|
45
63
|
class: className,
|
|
46
64
|
} = Astro.props;
|
|
47
65
|
|
|
@@ -70,13 +88,13 @@ const gradientClass = themeGradients[theme] || themeGradients.dark;
|
|
|
70
88
|
const heightClass = heightClasses[minHeight] || heightClasses.medium;
|
|
71
89
|
|
|
72
90
|
const slotHtml = async (name: string) => (Astro.slots.has(name) ? (await Astro.slots.render(name)).trim() : '');
|
|
73
|
-
const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
74
|
-
['badges', 'subtitle', 'info', 'actions', 'decoration'].map(slotHtml),
|
|
91
|
+
const [badges, subtitle, info, actions, decoration, caption] = await Promise.all(
|
|
92
|
+
['badges', 'subtitle', 'info', 'actions', 'decoration', 'caption'].map(slotHtml),
|
|
75
93
|
);
|
|
76
94
|
---
|
|
77
95
|
|
|
78
|
-
<section class:list={['relative flex items-end overflow-hidden', heightClass, className]}>
|
|
79
|
-
<div class="absolute inset-0 overflow-hidden">
|
|
96
|
+
{variant === 'overlay' && (<section data-hero class:list={['relative flex items-end overflow-hidden', heightClass, className]}>
|
|
97
|
+
<div class="absolute inset-0 overflow-hidden" data-hero-media>
|
|
80
98
|
{image ? (
|
|
81
99
|
<ResponsivePicture
|
|
82
100
|
src={image}
|
|
@@ -138,6 +156,7 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
138
156
|
{badges && <div class="flex flex-wrap gap-2 mb-4" set:html={badges} />}
|
|
139
157
|
|
|
140
158
|
<h1
|
|
159
|
+
data-hero-title
|
|
141
160
|
class:list={[
|
|
142
161
|
'font-medium text-overlay-foreground leading-[1.08] mb-4 font-display',
|
|
143
162
|
overlay === 'editorial'
|
|
@@ -167,4 +186,57 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
167
186
|
</div>
|
|
168
187
|
</div>
|
|
169
188
|
</div>
|
|
170
|
-
</section>
|
|
189
|
+
</section>)}
|
|
190
|
+
|
|
191
|
+
{variant !== 'overlay' && (
|
|
192
|
+
<section data-hero data-hero-variant={variant} class:list={['relative overflow-hidden', variant === 'split' ? 'bg-overlay text-overlay-foreground' : 'bg-background text-foreground', className]}>
|
|
193
|
+
<div class:list={['mx-auto max-w-shell px-4 sm:px-6 lg:px-8', variant === 'rail' && compact ? 'py-6 lg:py-10' : 'py-10 lg:py-14']}>
|
|
194
|
+
<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']}>
|
|
195
|
+
{variant === 'rail' && (info || actions) && (
|
|
196
|
+
<div class="order-2 lg:order-1 flex flex-col gap-4 lg:border-r lg:border-border lg:pr-8" data-hero-rail>
|
|
197
|
+
{info && <div set:html={info} />}
|
|
198
|
+
{actions && <div class="flex flex-wrap gap-3" set:html={actions} />}
|
|
199
|
+
</div>
|
|
200
|
+
)}
|
|
201
|
+
<div class:list={['min-w-0', variant === 'rail' && 'order-1 lg:order-2']}>
|
|
202
|
+
{badges && <div class="flex flex-wrap gap-2 mb-4" set:html={badges} />}
|
|
203
|
+
<h1 data-hero-title class:list={['font-display font-medium leading-[1.02] mb-4', variant === 'rail' && titleClass ? titleClass : 'text-[2rem] sm:text-5xl lg:text-6xl text-balance']}>{title}</h1>
|
|
204
|
+
{subtitle && <div class="mb-4" set:html={subtitle} />}
|
|
205
|
+
{description && <p class="text-lg leading-relaxed max-w-deck opacity-85">{description}</p>}
|
|
206
|
+
{variant === 'split' && info && <div class="mt-6 flex flex-wrap gap-3" set:html={info} />}
|
|
207
|
+
{variant === 'split' && actions && <div class="mt-5 flex flex-wrap gap-3" set:html={actions} />}
|
|
208
|
+
</div>
|
|
209
|
+
{variant === 'split' && image && (
|
|
210
|
+
<div data-hero-media class:list={['relative mx-auto w-full max-w-[26rem] aspect-square overflow-hidden bg-primary', mediaShape === 'circle' && 'rounded-full']}>
|
|
211
|
+
<ResponsivePicture
|
|
212
|
+
src={image}
|
|
213
|
+
alt={imageAlt}
|
|
214
|
+
title={imageTitle}
|
|
215
|
+
sizes="(max-width: 1024px) 80vw, 26rem"
|
|
216
|
+
quality={70}
|
|
217
|
+
class="w-full h-full object-cover"
|
|
218
|
+
pictureAttributes={{ class: 'block w-full h-full' }}
|
|
219
|
+
loading="eager"
|
|
220
|
+
fetchpriority="high"
|
|
221
|
+
/>
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
{variant === 'rail' && image && (
|
|
226
|
+
<Fragment><div data-hero-media class:list={[compact ? 'mt-6 lg:mt-8' : 'mt-10', mediaClass ?? 'aspect-[16/9] lg:aspect-[21/9]', 'overflow-hidden bg-muted', mediaShape === 'circle' && 'rounded-[2rem]']}>
|
|
227
|
+
<ResponsivePicture
|
|
228
|
+
src={image}
|
|
229
|
+
alt={imageAlt}
|
|
230
|
+
title={imageTitle}
|
|
231
|
+
sizes="(max-width: 1280px) 100vw, 1280px"
|
|
232
|
+
quality={70}
|
|
233
|
+
class="w-full h-full object-cover"
|
|
234
|
+
pictureAttributes={{ class: 'block w-full h-full' }}
|
|
235
|
+
loading="eager"
|
|
236
|
+
fetchpriority="high"
|
|
237
|
+
/>
|
|
238
|
+
</div>{caption && <p data-hero-caption class="mt-3 text-sm leading-snug text-muted-foreground" set:html={caption} />}</Fragment>
|
|
239
|
+
)}
|
|
240
|
+
</div>
|
|
241
|
+
</section>
|
|
242
|
+
)}
|
|
@@ -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>
|