@sarimarcus/content-sites-ui 0.58.0 → 0.60.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 CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All packages in the platform release in lockstep; entries are per release version.
4
4
 
5
+ ## 0.60.0 (2026-11-06)
6
+
7
+ Article cards and the editorial home lead link through core `articlePath`, so a site's `routes.articleItem` reaches them. Without that route the hrefs are unchanged: `render-diff` against 0.59.0 is identical for both with default routes (`tests/fixtures/render-diff/article-path-default.json`).
8
+
9
+ - `ArticleCardGrid`, `EditorialHomePage`: the article href is `articlePath(slug, category, routes)` instead of `routePath('articles', slug, routes)`.
10
+
11
+ ## 0.59.0 (2026-11-06)
12
+
13
+ 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`).
14
+
15
+ - `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.
16
+ - `ShareButtons`: `slim` renders one row of 44px icon circles, the copy-link button icon-only (its text stays for screen readers).
17
+ - `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.
18
+
5
19
  ## 0.58.0 (2026-11-05)
6
20
 
7
21
  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`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarimarcus/content-sites-ui",
3
- "version": "0.58.0",
3
+ "version": "0.60.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.58.0"
54
+ "@sarimarcus/content-sites-core": "0.60.0"
55
55
  }
56
56
  }
@@ -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} &rarr;</a></Fragment>}
31
+ </p>
32
+ </aside>
33
+ )}
@@ -9,7 +9,7 @@ import type { ImageMetadata } from 'astro';
9
9
  import { isUpdatedAfterPublication } from '@sarimarcus/content-sites-core/articles';
10
10
  import { formatDisplayDay } from '@sarimarcus/content-sites-core/dates';
11
11
  import { readingTime } from '@sarimarcus/content-sites-core/text';
12
- import { routePath, url as defaultUrl, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
12
+ import { articlePath, url as defaultUrl, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
13
13
  import { getLabels } from '../internal/labels';
14
14
  import ArticleGrid from './ArticleGrid.astro';
15
15
 
@@ -44,7 +44,7 @@ interface Props {
44
44
  locale?: string;
45
45
  readLabel?: string;
46
46
  updatedLabel?: string;
47
- /** Overrides of the `articles` route. */
47
+ /** Overrides of the article routes (`articleItem`). */
48
48
  routes?: SiteRoutes;
49
49
  /** Grid column count when `class` is not supplied (defaults to 3). */
50
50
  columns?: 2 | 3;
@@ -86,7 +86,7 @@ const items = articles.map(({ data: a }) => {
86
86
  ? `${readingTime(a)} ${minutesSuffix}`
87
87
  : undefined;
88
88
  return {
89
- href: resolveUrl(routePath('articles', a.slug, routes)),
89
+ href: resolveUrl(articlePath(a.slug, a.category, routes)),
90
90
  title: a.title,
91
91
  description: a.description,
92
92
  author: a.author,
@@ -29,6 +29,7 @@ import { getLabels } from '../internal/labels';
29
29
  import ArticleKeyFacts from './ArticleKeyFacts.astro';
30
30
  import ArticleTopicPager from './ArticleTopicPager.astro';
31
31
  import ShareButtons from './ShareButtons.astro';
32
+ import ArticleAuthorBio from './ArticleAuthorBio.astro';
32
33
  import Interlude from './interludes/Interlude.astro';
33
34
  import RelatedCard from './interludes/RelatedCard.astro';
34
35
  import { DEFAULT_INTERLUDE_LABELS } from './article-page';
@@ -379,8 +380,10 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
379
380
  showDates={showDates}
380
381
  era={era}
381
382
  eraBasePath={eraBasePath}
383
+ compact={editorial}
384
+ portrait={!(editorial && author?.bio)}
382
385
  /><slot name="rail" /></Fragment>
383
- <Fragment slot="actions">{showShareButtons && shareUrl && showShareTop && <ShareButtons url={shareUrl} title={article.title} locale={locale} />}</Fragment>
386
+ <Fragment slot="actions">{showShareButtons && shareUrl && showShareTop && <ShareButtons url={shareUrl} title={article.title} locale={locale} slim={editorial} />}</Fragment>
384
387
  </ContentHero>
385
388
  ) : (
386
389
  <ContentHero
@@ -426,6 +429,8 @@ const resolvedRelatedTitle = relatedProps.title ?? l.relatedTitle;
426
429
  </div>
427
430
  )}
428
431
 
432
+ {editorial && railHead && <ArticleAuthorBio author={author} locale={locale} />}
433
+
429
434
  <slot name="after-byline" />
430
435
 
431
436
  <div
@@ -20,7 +20,7 @@ import {
20
20
  type FeaturedSnapshot,
21
21
  } from '@sarimarcus/content-sites-core/articles';
22
22
  import { readingTime } from '@sarimarcus/content-sites-core/text';
23
- import { routePath, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
23
+ import { articlePath, routePath, type SiteRoutes } from '@sarimarcus/content-sites-core/url';
24
24
  import Container from '../layout/Container.astro';
25
25
  import { getLabels } from '../internal/labels';
26
26
  import ArticleCardGrid, { type ArticleCardGridEntry } from './ArticleCardGrid.astro';
@@ -142,7 +142,7 @@ const leadReadMins = lead?.data.sections ? readingTime({ sections: lead.data.sec
142
142
  <Container>
143
143
  <section aria-label={l.featuredEyebrow} class="mb-14">
144
144
  <ArticleFeatureCard
145
- href={url(routePath('articles', lead.data.slug, routes))}
145
+ href={url(articlePath(lead.data.slug, lead.data.category, routes))}
146
146
  title={lead.data.title}
147
147
  description={lead.data.description}
148
148
  author={lead.data.author ?? brand}
@@ -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 = compact
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="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"
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
 
@@ -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">