@sarimarcus/content-sites-ui 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/package.json +2 -2
- package/src/editorial/ArticleCategoryNav.astro +34 -6
- package/src/editorial/index.ts +1 -1
- package/src/editorial/types.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.25.0 (2026-10-05)
|
|
6
|
+
|
|
7
|
+
- `./editorial` `ArticleCategoryNav` builds its own links: it takes the articles and the site's category map (`categories`, in display order), links `/articles` and `/articles/topic/<slug>`, and defaults its "All" label and aria label. New type `ArticleCategoryMeta` (SLA-2961).
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- `ArticleCategoryNav` no longer takes resolved `categories`/`all` links: pass `articles` and `categories={ARTICLE_CATEGORIES}`. The tourism sites delete their adapter with `rewrite-imports.mjs --delete-local`, then run `scripts/platform/migrations/promoted-adapters.mjs`, which adds the prop at every call site (SLA-2961).
|
|
12
|
+
|
|
5
13
|
## 0.24.0 (2026-10-05)
|
|
6
14
|
|
|
7
15
|
- `./primitives`: `ResponsiveImage` and `ResponsivePicture`, the responsive image call site. They take `sizes` and never `widths`, `formats` or `fallbackFormat`: the variant service builds the ladder and serves WebP only (SLA-2960).
|
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ let a site keep its own roles.
|
|
|
125
125
|
- `AuthorCard`: whole-card link, polaroid, or plain card with a profile link. `AuthorStrip`: portraits row.
|
|
126
126
|
- `ArticleCard` / `ArticleGrid`: listing cards; `pagefindIgnore` for a listing that is itself indexed.
|
|
127
127
|
`ArticleFeatureCard` is the wide lead card.
|
|
128
|
-
- `ArticleCategoryNav`: "All" plus one chip per topic
|
|
128
|
+
- `ArticleCategoryNav`: "All" plus one chip per populated topic, with counts. Pass the articles and the site's category map (`label`, `icon`, in display order); it links `/articles` and `/articles/topic/<slug>`.
|
|
129
129
|
- `RelatedContent` / `RelatedContentCard` (in `./composed`, beside the CardCarousel they render): grid or carousel of `RelatedItem` cards, `tone` primary/accent/secondary.
|
|
130
130
|
Resolving which items to show (collections, scoring, backfill) stays a site adapter.
|
|
131
131
|
- `InsiderTips`: tip kinds are site keys mapped to a label and a tone.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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",
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
"@lucide/astro": "^1.23.0",
|
|
50
50
|
"astro": "^7.0.6",
|
|
51
51
|
"tailwindcss": "^4.1.18",
|
|
52
|
-
"@sarimarcus/content-sites-core": "0.
|
|
52
|
+
"@sarimarcus/content-sites-core": "0.25.0"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
---
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* ArticleCategoryNav — "All" plus one chip per populated topic, each with a count badge. `categories` is the site's
|
|
4
|
+
* category map in display order; a category with no article is left out.
|
|
5
|
+
*/
|
|
6
|
+
import { url } from '@sarimarcus/content-sites-core/url';
|
|
3
7
|
import Chip from '../primitives/Chip.astro';
|
|
4
8
|
import Badge from '../primitives/Badge.astro';
|
|
5
|
-
import type { ArticleCategoryLink } from './types';
|
|
9
|
+
import type { ArticleCategoryLink, ArticleCategoryMeta } from './types';
|
|
6
10
|
|
|
7
11
|
interface Props {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
articles: readonly { data: { category?: string | null } }[];
|
|
13
|
+
categories: Readonly<Record<string, ArticleCategoryMeta>>;
|
|
14
|
+
current?: string;
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
allLabel?: string;
|
|
11
17
|
class?: string;
|
|
12
18
|
}
|
|
13
19
|
|
|
14
|
-
const {
|
|
20
|
+
const {
|
|
21
|
+
articles,
|
|
22
|
+
categories: categoryMeta,
|
|
23
|
+
current,
|
|
24
|
+
ariaLabel = 'Browse articles by topic',
|
|
25
|
+
allLabel = 'All',
|
|
26
|
+
class: className,
|
|
27
|
+
} = Astro.props;
|
|
28
|
+
|
|
29
|
+
const counts = new Map<string, number>();
|
|
30
|
+
for (const a of articles) {
|
|
31
|
+
if (a.data.category) counts.set(a.data.category, (counts.get(a.data.category) ?? 0) + 1);
|
|
32
|
+
}
|
|
33
|
+
const categories: ArticleCategoryLink[] = Object.keys(categoryMeta)
|
|
34
|
+
.filter((slug) => counts.has(slug))
|
|
35
|
+
.map((slug) => ({
|
|
36
|
+
href: url(`/articles/topic/${slug}`),
|
|
37
|
+
label: categoryMeta[slug].label,
|
|
38
|
+
icon: categoryMeta[slug].icon,
|
|
39
|
+
count: counts.get(slug)!,
|
|
40
|
+
active: current === slug,
|
|
41
|
+
}));
|
|
42
|
+
const all = { href: url('/articles'), label: allLabel, count: articles.length, active: !current };
|
|
15
43
|
const countClass = (active: boolean) => (active ? 'bg-overlay-foreground/20' : 'bg-muted');
|
|
16
44
|
---
|
|
17
45
|
|
package/src/editorial/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { default as AuthorCard } from './AuthorCard.astro';
|
|
|
13
13
|
export { default as ArticleCard } from './ArticleCard.astro';
|
|
14
14
|
export { default as ArticleGrid } from './ArticleGrid.astro';
|
|
15
15
|
export { default as ArticleCategoryNav } from './ArticleCategoryNav.astro';
|
|
16
|
-
export type { AuthorSummary, ArticleSummary, KeyFact, SourceItem, ArticleCategoryLink } from './types';
|
|
16
|
+
export type { AuthorSummary, ArticleSummary, KeyFact, SourceItem, ArticleCategoryLink, ArticleCategoryMeta } from './types';
|
|
17
17
|
export { default as InsiderTips } from './InsiderTips.astro';
|
|
18
18
|
export type { InsiderTip, InsiderTipAuthor, InsiderTipKinds, InsiderTipTone } from './types';
|
|
19
19
|
export { default as AuthorStrip } from './AuthorStrip.astro';
|
package/src/editorial/types.ts
CHANGED
|
@@ -36,6 +36,12 @@ export interface KeyFact {
|
|
|
36
36
|
|
|
37
37
|
export type SourceItem = SourceInput;
|
|
38
38
|
|
|
39
|
+
/** The fields ArticleCategoryNav reads from a site's category map entry. */
|
|
40
|
+
export interface ArticleCategoryMeta {
|
|
41
|
+
label: string;
|
|
42
|
+
icon?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
/** One category chip in an article topic nav. */
|
|
40
46
|
export interface ArticleCategoryLink {
|
|
41
47
|
href: string;
|