@because-dev/astro 0.3.0 → 0.4.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/components/IdeaShell.astro +11 -4
- package/dist/index.d.ts +1 -1
- package/package.json +2 -2
- package/routes/idea.astro +1 -1
|
@@ -15,12 +15,14 @@ interface Props {
|
|
|
15
15
|
description?: string;
|
|
16
16
|
/** Which full-screen view opens first: the map or the article. */
|
|
17
17
|
view?: "map" | "article";
|
|
18
|
+
/** The idea's title, announced as the page heading while the article is hidden behind the map. */
|
|
19
|
+
heading?: string;
|
|
18
20
|
/** Home link in the top bar. */
|
|
19
21
|
homeHref: string;
|
|
20
22
|
homeLabel: string;
|
|
21
23
|
indexHref: string;
|
|
22
24
|
}
|
|
23
|
-
const { title, homeHref, homeLabel, indexHref, view = "map" } = Astro.props;
|
|
25
|
+
const { title, homeHref, homeLabel, indexHref, view = "map", heading } = Astro.props;
|
|
24
26
|
---
|
|
25
27
|
<!doctype html>
|
|
26
28
|
<html lang="en">
|
|
@@ -75,6 +77,10 @@ const { title, homeHref, homeLabel, indexHref, view = "map" } = Astro.props;
|
|
|
75
77
|
:where(.has-map[data-because-view="article"] .bc-side) { flex: none; width: var(--bc-side, 420px); border-left: 1px solid var(--bc-line); }
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
/* While the map hides the article, keep a page heading for screen readers (visually hidden). */
|
|
81
|
+
:where(.bc-maptitle) { display: none; }
|
|
82
|
+
:where(.has-map[data-because-view="map"] .bc-maptitle) { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
83
|
+
|
|
78
84
|
/* Floating switch between the two views, bottom right (hidden until the map mounts). */
|
|
79
85
|
:where(.bc-viewtoggle) { position: fixed; z-index: 5; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
|
|
80
86
|
min-width: 56px; height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--bc-line); background: var(--bc-ink); color: var(--bc-card);
|
|
@@ -102,10 +108,11 @@ const { title, homeHref, homeLabel, indexHref, view = "map" } = Astro.props;
|
|
|
102
108
|
<a class="bc-home" href={homeHref}>{homeLabel}</a>
|
|
103
109
|
<a class="bc-nav" href={indexHref}>All ideas</a>
|
|
104
110
|
</header>
|
|
105
|
-
<
|
|
111
|
+
<main class="bc-shell" data-because-views data-because-view={view}>
|
|
112
|
+
<h1 class="bc-maptitle">{heading ?? title}</h1>
|
|
106
113
|
<slot name="map" />
|
|
107
|
-
<
|
|
108
|
-
</
|
|
114
|
+
<div class="bc-side"><slot /></div>
|
|
115
|
+
</main>
|
|
109
116
|
<button type="button" class="bc-viewtoggle" data-because-view-toggle hidden></button>
|
|
110
117
|
</body>
|
|
111
118
|
</html>
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface BecauseOptions {
|
|
|
37
37
|
/**
|
|
38
38
|
* Your own shell for idea pages (with the map on), relative to the project root,
|
|
39
39
|
* e.g. "./src/layouts/IdeaShell.astro". It receives `title`, `description`,
|
|
40
|
-
* `homeHref`, `homeLabel`, `indexHref` and `
|
|
40
|
+
* `homeHref`, `homeLabel`, `indexHref`, `view` and `heading` (the idea's title) props and three slots: "head"
|
|
41
41
|
* (meta tags; render it in <head>), "map" (the map's root element; give it a
|
|
42
42
|
* size) and the default slot (the idea's article). For map/article switching,
|
|
43
43
|
* wrap both in an element with `data-because-views data-because-view={view}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@because-dev/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Astro integration: one static page per Because idea, the interactive map, and per-idea neighbourhood JSON.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"virtual.d.ts"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@because-dev/core": "0.
|
|
42
|
+
"@because-dev/core": "0.4.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"astro": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
package/routes/idea.astro
CHANGED
|
@@ -16,7 +16,7 @@ const site = createSite(graph, ctx);
|
|
|
16
16
|
const page = site.page(Astro.params.slug!)!;
|
|
17
17
|
const { idea } = page;
|
|
18
18
|
const { title, description, jsonLd } = ideaHead(page, config.siteName, Astro.site);
|
|
19
|
-
const shellProps = { title, description, view: config.view, homeHref: ctx.siteBase, homeLabel: config.siteName ?? "Home", indexHref: joinPath(ctx.siteBase, config.base, "/") };
|
|
19
|
+
const shellProps = { title, description, heading: idea.title, view: config.view, homeHref: ctx.siteBase, homeLabel: config.siteName ?? "Home", indexHref: joinPath(ctx.siteBase, config.base, "/") };
|
|
20
20
|
---
|
|
21
21
|
<!-- The full-screen map view and article view (or the site's own shell). -->
|
|
22
22
|
<Shell {...shellProps}>
|