@sarimarcus/content-sites-tourism 0.32.2 → 0.33.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/package.json +3 -3
- package/src/templates/DetailBody.astro +48 -0
- package/src/templates/detailBody.ts +19 -0
- package/src/templates/index.ts +3 -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.33.0 (2026-10-12)
|
|
6
|
+
|
|
7
|
+
- `./templates` adds `DetailBody` (lede plus one anchored `<section>` per H2, with `data-guide-section` on the article when the body has no H2) and `bodyTocItems`, so an entity page's ToC and body come from one array. Additive; adopting it on Granada's detail routes is an intended layout change (SLA-3043).
|
|
8
|
+
|
|
9
|
+
## 0.32.3 (2026-10-11)
|
|
10
|
+
|
|
11
|
+
- No changes; lockstep release with ui.
|
|
12
|
+
|
|
5
13
|
## 0.32.2 (2026-10-09)
|
|
6
14
|
|
|
7
15
|
- No changes; lockstep release with core (SLA-3037).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-tourism",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "City-tourism vertical: city-entity components, pages templates and utilities for the tourism sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"astro": "^7.0.6",
|
|
37
37
|
"tailwindcss": "^4.1.18",
|
|
38
|
-
"@sarimarcus/content-sites-core": "0.
|
|
39
|
-
"@sarimarcus/content-sites-ui": "0.
|
|
38
|
+
"@sarimarcus/content-sites-core": "0.33.0",
|
|
39
|
+
"@sarimarcus/content-sites-ui": "0.33.0"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Entity detail body: the `longDescription` lede plus one anchored `<section>`
|
|
4
|
+
* per H2, so the ToC (`bodyTocItems`) and the markup come from one array. Without
|
|
5
|
+
* a `longDescription` it renders the `fallback` slot, or `description` as a
|
|
6
|
+
* paragraph in the `#description` anchor.
|
|
7
|
+
*/
|
|
8
|
+
import type { DetailBodyContent } from './detailBody.ts';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
body: DetailBodyContent;
|
|
12
|
+
/** Whether the item has a longDescription; a blank one still renders the fallback. */
|
|
13
|
+
hasBody: boolean;
|
|
14
|
+
description?: string;
|
|
15
|
+
proseClass?: string;
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
body,
|
|
21
|
+
hasBody,
|
|
22
|
+
description,
|
|
23
|
+
proseClass = 'prose prose-lg',
|
|
24
|
+
class: className = 'mb-6',
|
|
25
|
+
} = Astro.props;
|
|
26
|
+
|
|
27
|
+
const showBody = hasBody && (!!body.lede || body.sections.length > 0);
|
|
28
|
+
// With no H2 the article is the lone ToC target, so it is the scroll-spy section.
|
|
29
|
+
const articleSection = body.sections.length === 0 ? { 'data-guide-section': '' } : {};
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
{showBody ? (
|
|
33
|
+
<article id="description" class:list={[proseClass, 'max-w-none scroll-mt-28', className]} data-pagefind-body {...articleSection}>
|
|
34
|
+
{body.lede && <Fragment set:html={body.lede} />}
|
|
35
|
+
{body.sections.map((s) => (
|
|
36
|
+
<section id={s.id} data-guide-section class="scroll-mt-28">
|
|
37
|
+
<h2 set:html={s.headingHtml} />
|
|
38
|
+
<Fragment set:html={s.html} />
|
|
39
|
+
</section>
|
|
40
|
+
))}
|
|
41
|
+
</article>
|
|
42
|
+
) : (
|
|
43
|
+
<div id="description" data-guide-section class:list={['scroll-mt-28', className]}>
|
|
44
|
+
<slot>
|
|
45
|
+
<p class="text-lg text-foreground leading-relaxed">{description}</p>
|
|
46
|
+
</slot>
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Shapes and helpers DetailBody takes. Structural, so any body splitter's output satisfies them.
|
|
2
|
+
import type { BodyContent, BodySection } from '@sarimarcus/content-sites-core/text';
|
|
3
|
+
import type { TableOfContentsItem } from '@sarimarcus/content-sites-ui/composed';
|
|
4
|
+
|
|
5
|
+
export type DetailBodySection = Pick<BodySection, 'id' | 'label' | 'headingHtml' | 'html'>;
|
|
6
|
+
|
|
7
|
+
export type DetailBodyContent = Pick<BodyContent, 'lede'> & { sections: DetailBodySection[] };
|
|
8
|
+
|
|
9
|
+
export type TocItem = TableOfContentsItem;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* ToC pills for the body, from the same sections DetailBody renders. A body with
|
|
13
|
+
* no H2 still renders inside the `#description` anchor, so it keeps one pill.
|
|
14
|
+
*/
|
|
15
|
+
export function bodyTocItems(body: DetailBodyContent, fallbackLabel = 'About'): TocItem[] {
|
|
16
|
+
return body.sections.length > 0
|
|
17
|
+
? body.sections.map((s) => ({ label: s.label, href: `#${s.id}` }))
|
|
18
|
+
: [{ label: fallbackLabel, href: '#description' }];
|
|
19
|
+
}
|
package/src/templates/index.ts
CHANGED
|
@@ -8,3 +8,6 @@ export type { NeighborhoodFacetTone } from './NeighborhoodFacetPage.astro';
|
|
|
8
8
|
export type { ProximityIntroSection, ProximityEditorialGroup } from './ProximityFacetPage.astro';
|
|
9
9
|
export type { TierFacetTone, TierNav, TierNavItem } from './TierFacetPage.astro';
|
|
10
10
|
export type { CategoryFacetTone } from './CategoryFacetPage.astro';
|
|
11
|
+
export { default as DetailBody } from './DetailBody.astro';
|
|
12
|
+
export { bodyTocItems } from './detailBody.ts';
|
|
13
|
+
export type { DetailBodyContent, DetailBodySection, TocItem } from './detailBody.ts';
|