@sarimarcus/content-sites-ui 0.57.1 → 0.59.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 +16 -0
- package/package.json +2 -2
- package/src/composed/TableOfContents.astro +19 -3
- package/src/editorial/ArticleAuthorBio.astro +33 -0
- package/src/editorial/ArticlePage.astro +70 -10
- package/src/editorial/ShareButtons.astro +9 -4
- package/src/layout/ContentHero.astro +15 -6
- package/src/seo/ArticleMetadata.astro +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.59.0 (2026-11-06)
|
|
6
|
+
|
|
7
|
+
Opt-in slimmer author block for the editorial article head. Defaults keep today's markup: `render-diff` against 0.58.0 is byte-identical for `ArticleMetadata`, `ShareButtons` (default and `compact`) and `ArticlePage` with the standard head (`tests/fixtures/render-diff/editorial-byline.json`).
|
|
8
|
+
|
|
9
|
+
- `ArticleMetadata`: `compact` renders one line (small portrait, "written by", name, and the date when `showDates`) and drops the role badge, credentials, bio toggle and expertise; `portrait` (with `compact`, default true) hides the small portrait.
|
|
10
|
+
- `ShareButtons`: `slim` renders one row of 44px icon circles, the copy-link button icon-only (its text stays for screen readers).
|
|
11
|
+
- `ArticleAuthorBio` (new, in `editorial`): the author's portrait, name as a link, full bio and profile link. `ArticlePage` with `headVariant="editorial"` and a hero photo renders it after the photo, passes `compact` and `slim` to the rail, and hides the rail portrait when the author has a bio.
|
|
12
|
+
|
|
13
|
+
## 0.58.0 (2026-11-05)
|
|
14
|
+
|
|
15
|
+
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`.
|
|
16
|
+
|
|
17
|
+
- `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).
|
|
18
|
+
- `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).
|
|
19
|
+
- `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.
|
|
20
|
+
|
|
5
21
|
## 0.57.1 (2026-11-05)
|
|
6
22
|
|
|
7
23
|
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".
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.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.59.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;
|
|
@@ -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';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ArticleAuthorBio: the author's full bio under the hero photo of an editorial article (name as a link, then the
|
|
4
|
+
* bio, then the profile link). Renders nothing without a bio.
|
|
5
|
+
*/
|
|
6
|
+
import { Image } from 'astro:assets';
|
|
7
|
+
import type { ArticleAuthor } from '../seo/types';
|
|
8
|
+
import { getLabels } from '../internal/labels';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
author?: ArticleAuthor | null;
|
|
12
|
+
locale?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { author, locale, class: className = '' } = Astro.props;
|
|
17
|
+
const l = getLabels(locale).articleMetadata;
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
{author?.bio && (
|
|
21
|
+
<aside class:list={['flex items-start gap-3 mb-8', className]} aria-label={l.aboutAuthorLabel} data-author-bio>
|
|
22
|
+
{author.image ? (
|
|
23
|
+
<Image src={author.image} alt="" width={96} height={96} class="w-12 h-12 rounded-full object-cover bg-muted shrink-0" loading="lazy" decoding="async" />
|
|
24
|
+
) : author.photoUrl ? (
|
|
25
|
+
<img src={author.photoUrl} alt="" width="48" height="48" class="w-12 h-12 rounded-full object-cover bg-muted shrink-0" loading="lazy" decoding="async" />
|
|
26
|
+
) : null}
|
|
27
|
+
<p class="text-sm leading-relaxed text-muted-foreground">
|
|
28
|
+
{author.href ? <a href={author.href} rel="author" class="font-semibold text-foreground hover:text-primary hover:underline">{author.name}</a> : <span class="font-semibold text-foreground">{author.name}</span>}
|
|
29
|
+
{' '}{author.bio}
|
|
30
|
+
{author.href && <Fragment>{' '}<a href={author.href} class="font-medium text-primary hover:underline whitespace-nowrap">{l.fullProfileLabel} →</a></Fragment>}
|
|
31
|
+
</p>
|
|
32
|
+
</aside>
|
|
33
|
+
)}
|
|
@@ -23,11 +23,13 @@ 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';
|
|
29
30
|
import ArticleTopicPager from './ArticleTopicPager.astro';
|
|
30
31
|
import ShareButtons from './ShareButtons.astro';
|
|
32
|
+
import ArticleAuthorBio from './ArticleAuthorBio.astro';
|
|
31
33
|
import Interlude from './interludes/Interlude.astro';
|
|
32
34
|
import RelatedCard from './interludes/RelatedCard.astro';
|
|
33
35
|
import { DEFAULT_INTERLUDE_LABELS } from './article-page';
|
|
@@ -67,6 +69,8 @@ export interface ArticlePageData {
|
|
|
67
69
|
intro: string;
|
|
68
70
|
imageAlt: string;
|
|
69
71
|
imageTitle?: string;
|
|
72
|
+
/** One line under the hero photo (inline markdown); shown by `headVariant="editorial"`. */
|
|
73
|
+
imageCaption?: string;
|
|
70
74
|
author?: string;
|
|
71
75
|
datePublished?: string;
|
|
72
76
|
dateModified?: string;
|
|
@@ -107,6 +111,16 @@ interface Props {
|
|
|
107
111
|
/** Article head: the photo-behind-title `overlay` (default), a solid `split` band, or a `rail` of byline and share beside the headline. */
|
|
108
112
|
heroVariant?: 'overlay' | 'split' | 'rail';
|
|
109
113
|
heroMediaShape?: 'rect' | 'circle';
|
|
114
|
+
/**
|
|
115
|
+
* `editorial`: a Verge-style reading layout. A rail head (category chip, headline, deck and photo with caption; byline
|
|
116
|
+
* and share in the left rail), a "← back" link replacing the breadcrumb on mobile, a larger near-black body with the
|
|
117
|
+
* drop cap on, and the section list in a sticky side column from 1360px. Implies the `rail` hero, which needs a hero
|
|
118
|
+
* image: without one the page falls back to the plain no-hero head and `categoryChip` and the caption do not render.
|
|
119
|
+
* The default `standard` changes nothing.
|
|
120
|
+
*/
|
|
121
|
+
headVariant?: 'standard' | 'editorial';
|
|
122
|
+
/** `editorial`: the chip above the headline, a link when `href` is set. */
|
|
123
|
+
categoryChip?: { label: string; href?: string };
|
|
110
124
|
/** Replaces the breadcrumb band's classes; keep its top padding to clear the fixed header. */
|
|
111
125
|
breadcrumbBandClass?: string;
|
|
112
126
|
/** Enable decorative drop-cap on the lede paragraph when it starts with a letter/quote. */
|
|
@@ -174,6 +188,8 @@ const {
|
|
|
174
188
|
showDates = true,
|
|
175
189
|
heroVariant = 'overlay',
|
|
176
190
|
heroMediaShape = 'rect',
|
|
191
|
+
headVariant = 'standard',
|
|
192
|
+
categoryChip,
|
|
177
193
|
breadcrumbBandClass,
|
|
178
194
|
dropCap = false,
|
|
179
195
|
emitAudienceFacets = false,
|
|
@@ -195,13 +211,26 @@ const {
|
|
|
195
211
|
relatedProps = {},
|
|
196
212
|
backLink = null,
|
|
197
213
|
} = Astro.props;
|
|
198
|
-
const
|
|
214
|
+
const editorial = headVariant === 'editorial';
|
|
215
|
+
const railHead = (heroVariant === 'rail' || editorial) && !!heroImage;
|
|
199
216
|
|
|
200
217
|
const l = getLabels(locale).articlePage;
|
|
201
218
|
const sourcesLen = article.sources?.length ?? 0;
|
|
202
219
|
const md = (text: string) => trustedHtml(renderInlineMarkdown(text, basePath, sourcesLen));
|
|
203
220
|
const introHtml = parseMarkdownInline(article.intro, basePath, sourcesLen);
|
|
204
|
-
const hasDropCap = dropCap && /^["'«“‘]?[A-Za-zÀ-ÖØ-öø-ÿ]/.test(article.intro.trimStart());
|
|
221
|
+
const hasDropCap = (dropCap || editorial) && /^["'«“‘]?[A-Za-zÀ-ÖØ-öø-ÿ]/.test(article.intro.trimStart());
|
|
222
|
+
const ledeClass = editorial
|
|
223
|
+
? 'article-lede text-foreground mb-8 font-normal'
|
|
224
|
+
: 'article-lede text-foreground/90 mb-8 font-normal border-l-2 border-primary/40 pl-5';
|
|
225
|
+
const paragraphClass = editorial
|
|
226
|
+
? 'text-lg sm:text-xl text-foreground leading-[1.65] mb-5'
|
|
227
|
+
: 'text-base text-muted-foreground leading-relaxed mb-4';
|
|
228
|
+
const subParagraphClass = editorial
|
|
229
|
+
? 'text-lg sm:text-xl text-foreground leading-[1.65] mb-4'
|
|
230
|
+
: 'text-base text-muted-foreground leading-relaxed mb-3';
|
|
231
|
+
const headTitleClass =
|
|
232
|
+
'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';
|
|
233
|
+
const headMediaClass = 'aspect-[16/9]';
|
|
205
234
|
|
|
206
235
|
const tocItems = article.sections.map((s) => ({
|
|
207
236
|
label: s.heading,
|
|
@@ -306,9 +335,19 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
306
335
|
<span class="sr-only" data-pagefind-filter={`audience:${a}`}>{a}</span>
|
|
307
336
|
))}
|
|
308
337
|
|
|
338
|
+
{editorial && backLink ? (
|
|
339
|
+
<BreadcrumbBand class={breadcrumbBandClass}>
|
|
340
|
+
<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">
|
|
341
|
+
<span aria-hidden="true">←</span>
|
|
342
|
+
<span>{backLink.label ?? l.allArticlesLabel}</span>
|
|
343
|
+
</a>
|
|
344
|
+
<div class="hidden sm:block"><Breadcrumb items={breadcrumbs} {...breadcrumbProps} /></div>
|
|
345
|
+
</BreadcrumbBand>
|
|
346
|
+
) : (
|
|
309
347
|
<BreadcrumbBand class={breadcrumbBandClass}>
|
|
310
348
|
<Breadcrumb items={breadcrumbs} {...breadcrumbProps} />
|
|
311
349
|
</BreadcrumbBand>
|
|
350
|
+
)}
|
|
312
351
|
|
|
313
352
|
{heroImage ? (
|
|
314
353
|
railHead ? (
|
|
@@ -320,7 +359,18 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
320
359
|
imageTitle={article.imageTitle}
|
|
321
360
|
variant="rail"
|
|
322
361
|
mediaShape={heroMediaShape}
|
|
362
|
+
titleClass={editorial ? headTitleClass : undefined}
|
|
363
|
+
mediaClass={editorial ? headMediaClass : undefined}
|
|
364
|
+
compact={editorial}
|
|
323
365
|
>
|
|
366
|
+
{editorial && categoryChip && (
|
|
367
|
+
<Fragment slot="badges">{categoryChip.href ? (
|
|
368
|
+
<Chip href={categoryChip.href} size="sm" tone="outlineQuiet">{categoryChip.label}</Chip>
|
|
369
|
+
) : (
|
|
370
|
+
<Badge tone="primary" size="sm" lines={1}>{categoryChip.label}</Badge>
|
|
371
|
+
)}</Fragment>
|
|
372
|
+
)}
|
|
373
|
+
{editorial && article.imageCaption && <Fragment slot="caption" set:html={md(article.imageCaption)} />}
|
|
324
374
|
<Fragment slot="info"><ArticleMetadata
|
|
325
375
|
author={author}
|
|
326
376
|
datePublished={article.datePublished}
|
|
@@ -330,8 +380,10 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
330
380
|
showDates={showDates}
|
|
331
381
|
era={era}
|
|
332
382
|
eraBasePath={eraBasePath}
|
|
333
|
-
|
|
334
|
-
|
|
383
|
+
compact={editorial}
|
|
384
|
+
portrait={!(editorial && author?.bio)}
|
|
385
|
+
/><slot name="rail" /></Fragment>
|
|
386
|
+
<Fragment slot="actions">{showShareButtons && shareUrl && showShareTop && <ShareButtons url={shareUrl} title={article.title} locale={locale} slim={editorial} />}</Fragment>
|
|
335
387
|
</ContentHero>
|
|
336
388
|
) : (
|
|
337
389
|
<ContentHero
|
|
@@ -359,7 +411,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
359
411
|
)}
|
|
360
412
|
|
|
361
413
|
<main>
|
|
362
|
-
<Container size="measure" class=
|
|
414
|
+
<Container size="measure" class={editorial ? 'relative pt-6 pb-10 sm:pt-8 sm:pb-14' : 'py-10 sm:py-14'}>
|
|
363
415
|
{!railHead && <ArticleMetadata
|
|
364
416
|
author={author}
|
|
365
417
|
datePublished={article.datePublished}
|
|
@@ -377,10 +429,12 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
377
429
|
</div>
|
|
378
430
|
)}
|
|
379
431
|
|
|
432
|
+
{editorial && railHead && <ArticleAuthorBio author={author} locale={locale} />}
|
|
433
|
+
|
|
380
434
|
<slot name="after-byline" />
|
|
381
435
|
|
|
382
436
|
<div
|
|
383
|
-
class=
|
|
437
|
+
class={ledeClass}
|
|
384
438
|
data-dropcap={hasDropCap ? '' : undefined}
|
|
385
439
|
set:html={introHtml}
|
|
386
440
|
/>
|
|
@@ -396,9 +450,15 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
396
450
|
)}
|
|
397
451
|
|
|
398
452
|
{showToc && (
|
|
399
|
-
<div class=
|
|
453
|
+
<Fragment><div class={editorial ? 'mb-10 min-[1360px]:hidden' : 'mb-10'} data-pagefind-ignore>
|
|
400
454
|
<TableOfContents items={tocItems} eyebrow={l.tocEyebrow} headerClass="max-md:hidden" {...tocProps} />
|
|
401
|
-
</div>
|
|
455
|
+
</div>{editorial && (
|
|
456
|
+
<aside class="absolute left-full top-0 bottom-0 ml-10 hidden w-52 min-[1360px]:block" data-article-toc-margin data-pagefind-ignore>
|
|
457
|
+
<div class="sticky top-28">
|
|
458
|
+
<TableOfContents variant="margin" items={tocItems} eyebrow={l.tocEyebrow} ariaLabel={l.tocEyebrow} />
|
|
459
|
+
</div>
|
|
460
|
+
</aside>
|
|
461
|
+
)}</Fragment>
|
|
402
462
|
)}
|
|
403
463
|
|
|
404
464
|
<div class={proseClass}>
|
|
@@ -416,7 +476,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
416
476
|
</h2>
|
|
417
477
|
{blocks.map((block) => {
|
|
418
478
|
if (block.kind === 'paragraph') {
|
|
419
|
-
return <div class=
|
|
479
|
+
return <div class={paragraphClass} set:html={block.html} />;
|
|
420
480
|
}
|
|
421
481
|
if (block.kind === 'interlude') {
|
|
422
482
|
return (
|
|
@@ -466,7 +526,7 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
|
|
|
466
526
|
{sub.heading}
|
|
467
527
|
</h3>
|
|
468
528
|
{sub.paragraphs.map((pHtml) => (
|
|
469
|
-
<div class=
|
|
529
|
+
<div class={subParagraphClass} set:html={pHtml} />
|
|
470
530
|
))}
|
|
471
531
|
</div>
|
|
472
532
|
))}
|
|
@@ -12,6 +12,8 @@ interface Props {
|
|
|
12
12
|
title: string;
|
|
13
13
|
locale?: string;
|
|
14
14
|
compact?: boolean;
|
|
15
|
+
/** One row of 44px icon circles; the copy-link button loses its text and stays coloured while focused after a click. */
|
|
16
|
+
slim?: boolean;
|
|
15
17
|
class?: string;
|
|
16
18
|
ariaLabel?: string;
|
|
17
19
|
shareLabel?: string;
|
|
@@ -29,6 +31,7 @@ const {
|
|
|
29
31
|
title,
|
|
30
32
|
locale,
|
|
31
33
|
compact = false,
|
|
34
|
+
slim = false,
|
|
32
35
|
class: className = '',
|
|
33
36
|
ariaLabel,
|
|
34
37
|
shareLabel,
|
|
@@ -53,7 +56,9 @@ const resolvedCopyLabel = copyLabel ?? l.copyLabel;
|
|
|
53
56
|
const resolvedCopiedLabel = copiedLabel ?? l.copiedLabel;
|
|
54
57
|
|
|
55
58
|
const urls = buildShareUrls({ url, title });
|
|
56
|
-
const btnClass =
|
|
59
|
+
const btnClass = slim
|
|
60
|
+
? 'inline-flex items-center justify-center min-h-[44px] min-w-[44px] w-11 h-11 rounded-full border border-border text-muted-foreground hover:text-primary hover:border-primary/40 focus-visible:text-primary focus-visible:border-primary transition-colors'
|
|
61
|
+
: compact
|
|
57
62
|
? 'inline-flex items-center justify-center min-h-[44px] min-w-[44px] w-11 h-11 rounded-full border border-border bg-card/80 text-muted-foreground hover:text-primary hover:border-primary/40 transition-colors'
|
|
58
63
|
: 'inline-flex items-center justify-center min-h-[44px] min-w-[44px] w-11 h-11 rounded-full border border-border bg-card text-muted-foreground hover:text-primary hover:border-primary/40 transition-colors';
|
|
59
64
|
---
|
|
@@ -66,7 +71,7 @@ const btnClass = compact
|
|
|
66
71
|
data-share-url={url}
|
|
67
72
|
data-share-title={title}
|
|
68
73
|
>
|
|
69
|
-
{!compact && (
|
|
74
|
+
{!compact && !slim && (
|
|
70
75
|
<span class="text-xs font-semibold uppercase tracking-wider text-muted-foreground mr-1">
|
|
71
76
|
{resolvedShareLabel}
|
|
72
77
|
</span>
|
|
@@ -148,13 +153,13 @@ const btnClass = compact
|
|
|
148
153
|
data-copied-label={resolvedCopiedLabel}
|
|
149
154
|
aria-label={resolvedCopyLabel}
|
|
150
155
|
title={resolvedCopyLabel}
|
|
151
|
-
class=
|
|
156
|
+
class={slim ? btnClass : 'inline-flex items-center gap-1.5 px-3.5 min-h-[44px] h-11 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground hover:text-primary hover:border-primary/40 transition-colors'}
|
|
152
157
|
>
|
|
153
158
|
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
154
159
|
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
|
155
160
|
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
|
156
161
|
</svg>
|
|
157
|
-
<span data-copy-text aria-live="polite">{resolvedCopyLabel}</span>
|
|
162
|
+
<span data-copy-text aria-live="polite" class:list={[slim && 'sr-only']}>{resolvedCopyLabel}</span>
|
|
158
163
|
</button>
|
|
159
164
|
</div>
|
|
160
165
|
|
|
@@ -33,6 +33,12 @@ interface Props {
|
|
|
33
33
|
variant?: 'overlay' | 'split' | 'rail';
|
|
34
34
|
mediaShape?: 'rect' | 'circle';
|
|
35
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;
|
|
36
42
|
class?: string;
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -51,6 +57,9 @@ const {
|
|
|
51
57
|
variant = 'overlay',
|
|
52
58
|
mediaShape = 'rect',
|
|
53
59
|
minHeight = 'medium',
|
|
60
|
+
titleClass,
|
|
61
|
+
mediaClass,
|
|
62
|
+
compact = false,
|
|
54
63
|
class: className,
|
|
55
64
|
} = Astro.props;
|
|
56
65
|
|
|
@@ -79,8 +88,8 @@ const gradientClass = themeGradients[theme] || themeGradients.dark;
|
|
|
79
88
|
const heightClass = heightClasses[minHeight] || heightClasses.medium;
|
|
80
89
|
|
|
81
90
|
const slotHtml = async (name: string) => (Astro.slots.has(name) ? (await Astro.slots.render(name)).trim() : '');
|
|
82
|
-
const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
83
|
-
['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),
|
|
84
93
|
);
|
|
85
94
|
---
|
|
86
95
|
|
|
@@ -181,7 +190,7 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
181
190
|
|
|
182
191
|
{variant !== 'overlay' && (
|
|
183
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]}>
|
|
184
|
-
<div class=
|
|
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']}>
|
|
185
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']}>
|
|
186
195
|
{variant === 'rail' && (info || actions) && (
|
|
187
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>
|
|
@@ -191,7 +200,7 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
191
200
|
)}
|
|
192
201
|
<div class:list={['min-w-0', variant === 'rail' && 'order-1 lg:order-2']}>
|
|
193
202
|
{badges && <div class="flex flex-wrap gap-2 mb-4" set:html={badges} />}
|
|
194
|
-
<h1 data-hero-title class=
|
|
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>
|
|
195
204
|
{subtitle && <div class="mb-4" set:html={subtitle} />}
|
|
196
205
|
{description && <p class="text-lg leading-relaxed max-w-deck opacity-85">{description}</p>}
|
|
197
206
|
{variant === 'split' && info && <div class="mt-6 flex flex-wrap gap-3" set:html={info} />}
|
|
@@ -214,7 +223,7 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
214
223
|
)}
|
|
215
224
|
</div>
|
|
216
225
|
{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]']}>
|
|
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]']}>
|
|
218
227
|
<ResponsivePicture
|
|
219
228
|
src={image}
|
|
220
229
|
alt={imageAlt}
|
|
@@ -226,7 +235,7 @@ const [badges, subtitle, info, actions, decoration] = await Promise.all(
|
|
|
226
235
|
loading="eager"
|
|
227
236
|
fetchpriority="high"
|
|
228
237
|
/>
|
|
229
|
-
</div>
|
|
238
|
+
</div>{caption && <p data-hero-caption class="mt-3 text-sm leading-snug text-muted-foreground" set:html={caption} />}</Fragment>
|
|
230
239
|
)}
|
|
231
240
|
</div>
|
|
232
241
|
</section>
|
|
@@ -47,6 +47,10 @@ interface Props {
|
|
|
47
47
|
era?: EraDefinition;
|
|
48
48
|
/** Base path of the chronology page the era chip links to. */
|
|
49
49
|
eraBasePath?: string;
|
|
50
|
+
/** One quiet line: small portrait, "written by" and the name. Job title, credentials, expertise and the bio are not shown; the page renders the bio (ArticleAuthorBio) separately. */
|
|
51
|
+
compact?: boolean;
|
|
52
|
+
/** With `compact`: show the small portrait (default). A page that shows it in the bio passes false. */
|
|
53
|
+
portrait?: boolean;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
const defaultLabels = getLabels(Astro.props.locale ?? Astro.currentLocale);
|
|
@@ -68,6 +72,8 @@ const {
|
|
|
68
72
|
showDates = true,
|
|
69
73
|
era,
|
|
70
74
|
eraBasePath,
|
|
75
|
+
compact = false,
|
|
76
|
+
portrait = true,
|
|
71
77
|
} = Astro.props;
|
|
72
78
|
const { era: _era, eraBasePath: _eraBasePath, ...bylineProps } = Astro.props;
|
|
73
79
|
|
|
@@ -93,6 +99,29 @@ const bylineLead = author ? (grouped ? ' ' : ' ') : (grouped ? '' : ' ');
|
|
|
93
99
|
<div class="min-w-0 basis-full sm:basis-0 sm:flex-1"><Astro.self {...bylineProps} /></div>
|
|
94
100
|
<EraChip era={era} basePath={eraBasePath} class="mb-5 self-start" />
|
|
95
101
|
</div>
|
|
102
|
+
) : compact ? (
|
|
103
|
+
<address class="not-italic mb-4 flex items-center gap-2.5" role="group" aria-label={ariaLabel}>
|
|
104
|
+
{author && portrait && (author.image ? (
|
|
105
|
+
<Image src={author.image} alt={portraitAlt} width={64} height={64} class="w-8 h-8 rounded-full object-cover bg-muted shrink-0" data-byline-avatar loading="lazy" decoding="async" />
|
|
106
|
+
) : author.photoUrl ? (
|
|
107
|
+
<img src={author.photoUrl} alt={portraitAlt} width="32" height="32" class="w-8 h-8 rounded-full object-cover bg-muted shrink-0" data-byline-avatar loading="lazy" decoding="async" />
|
|
108
|
+
) : (
|
|
109
|
+
<div class:list={['w-8 h-8 rounded-full', placeholderClass, 'shrink-0']} data-byline-avatar aria-hidden="true" />
|
|
110
|
+
))}
|
|
111
|
+
<div class="min-w-0 text-sm leading-snug">
|
|
112
|
+
{author && <span class="text-muted-foreground">{writtenByLabel} </span>}
|
|
113
|
+
{author && (author.href ? (
|
|
114
|
+
<a href={author.href} rel="author" class="font-semibold text-foreground hover:text-primary hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary">{name}</a>
|
|
115
|
+
) : (
|
|
116
|
+
<span class="font-semibold text-foreground">{name}</span>
|
|
117
|
+
))}
|
|
118
|
+
{showDates && (showModified && modifiedFormatted ? (
|
|
119
|
+
<div class="text-xs text-muted-foreground">{updatedLabel} <time datetime={dateModified}>{modifiedFormatted}</time></div>
|
|
120
|
+
) : publishedFormatted && (
|
|
121
|
+
<div class="text-xs text-muted-foreground"><time datetime={datePublished}>{publishedFormatted}</time></div>
|
|
122
|
+
))}
|
|
123
|
+
</div>
|
|
124
|
+
</address>
|
|
96
125
|
) : (
|
|
97
126
|
<address class="not-italic mb-5" role="group" aria-label={ariaLabel}>
|
|
98
127
|
<div class="flex items-start gap-3">
|