@opentf/afw-docs 0.32.0 → 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/components/Navbar.jsx +2 -0
- package/components/NavbarMenu.jsx +58 -0
- package/package.json +6 -6
- package/theme/index.css +40 -2
package/components/Navbar.jsx
CHANGED
|
@@ -10,6 +10,7 @@ import Search from "./Search.jsx";
|
|
|
10
10
|
import SidebarToggle from "./SidebarToggle.jsx";
|
|
11
11
|
import NavbarLink from "./NavbarLink.jsx";
|
|
12
12
|
import NavIcon from "./NavIcon.jsx";
|
|
13
|
+
import NavbarMenu from "./NavbarMenu.jsx";
|
|
13
14
|
import { Link } from "@opentf/afw";
|
|
14
15
|
|
|
15
16
|
// `aria-label` / `aria-labelledby` name the banner landmark, `navLabel` names the
|
|
@@ -55,6 +56,7 @@ export default function Navbar(props) {
|
|
|
55
56
|
</a>
|
|
56
57
|
) : null}
|
|
57
58
|
<ThemeToggle />
|
|
59
|
+
{links.length ? <NavbarMenu links={links} /> : null}
|
|
58
60
|
</div>
|
|
59
61
|
{config.search ? <Search /> : null}
|
|
60
62
|
</div>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// The navbar's menu on small screens, for pages without a sidebar drawer (a marketing
|
|
2
|
+
// home, a landing page): a button that opens the top-level links below the bar. On
|
|
3
|
+
// pages with a sidebar the links live in the drawer instead, so CSS shows this button
|
|
4
|
+
// only below the sidebar breakpoint and only while no <Sidebar> is mounted
|
|
5
|
+
// (`:root:not([data-afw-has-sidebar])`). It closes on navigation and on Escape.
|
|
6
|
+
|
|
7
|
+
import { onMount, router } from "@opentf/afw";
|
|
8
|
+
import NavbarLink from "./NavbarLink.jsx";
|
|
9
|
+
|
|
10
|
+
export default function NavbarMenu(props) {
|
|
11
|
+
const links = props.links || [];
|
|
12
|
+
let open = $state(false);
|
|
13
|
+
|
|
14
|
+
// A navigation (any link, here or elsewhere) closes the menu.
|
|
15
|
+
$effect(() => {
|
|
16
|
+
router.pathname;
|
|
17
|
+
open = false;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
onMount(() => {
|
|
21
|
+
const onKey = (e) => {
|
|
22
|
+
if (e.key === "Escape") open = false;
|
|
23
|
+
};
|
|
24
|
+
window.addEventListener("keydown", onKey);
|
|
25
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div class="afwd-navbar-menu-wrap">
|
|
30
|
+
<button
|
|
31
|
+
class="afwd-navbar-icon afwd-navbar-menu-toggle"
|
|
32
|
+
onclick={() => (open = !open)}
|
|
33
|
+
aria-label="Menu"
|
|
34
|
+
aria-controls="afw-navbar-menu"
|
|
35
|
+
aria-expanded={open ? "true" : "false"}
|
|
36
|
+
>
|
|
37
|
+
{() =>
|
|
38
|
+
open ? (
|
|
39
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
|
40
|
+
<path d="M6 6l12 12M18 6L6 18" />
|
|
41
|
+
</svg>
|
|
42
|
+
) : (
|
|
43
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
|
44
|
+
<path d="M4 7h16M4 12h16M4 17h16" />
|
|
45
|
+
</svg>
|
|
46
|
+
)}
|
|
47
|
+
</button>
|
|
48
|
+
{() =>
|
|
49
|
+
open ? (
|
|
50
|
+
<nav id="afw-navbar-menu" class="afwd-navbar-menu" aria-label="Menu">
|
|
51
|
+
{links.map((l) => (
|
|
52
|
+
<NavbarLink link={l} />
|
|
53
|
+
))}
|
|
54
|
+
</nav>
|
|
55
|
+
) : null}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentf/afw-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Documentation and blog sites built as ordinary AFW apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -69,18 +69,18 @@
|
|
|
69
69
|
"bugs": "https://github.com/Open-Tech-Foundation/afw/issues",
|
|
70
70
|
"license": "MIT",
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@opentf/afw": "0.
|
|
72
|
+
"@opentf/afw": "0.35.0"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@opentf/afw-compiler": "0.
|
|
78
|
+
"@opentf/afw-compiler": "0.23.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@opentf/afw": "0.
|
|
82
|
-
"@opentf/afw-test": "1.
|
|
83
|
-
"@opentf/vite-plugin-afw": "0.
|
|
81
|
+
"@opentf/afw": "0.35.0",
|
|
82
|
+
"@opentf/afw-test": "1.30.0",
|
|
83
|
+
"@opentf/vite-plugin-afw": "0.3.0",
|
|
84
84
|
"vite": "8.3.5"
|
|
85
85
|
},
|
|
86
86
|
"types": "./types/index.d.ts"
|
package/theme/index.css
CHANGED
|
@@ -311,8 +311,44 @@
|
|
|
311
311
|
.afwd-navbar-version {
|
|
312
312
|
display: none; /* reclaim brand width on small screens */
|
|
313
313
|
}
|
|
314
|
-
:
|
|
315
|
-
|
|
314
|
+
/* The links leave the bar: into the drawer on pages with a sidebar, into the menu
|
|
315
|
+
* (NavbarMenu) on pages without one. */
|
|
316
|
+
.afwd-navbar-nav {
|
|
317
|
+
display: none;
|
|
318
|
+
}
|
|
319
|
+
:root:not([data-afw-has-sidebar]) .afwd-navbar-menu-toggle {
|
|
320
|
+
display: inline-flex;
|
|
321
|
+
}
|
|
322
|
+
.afwd-navbar-menu {
|
|
323
|
+
position: absolute;
|
|
324
|
+
top: var(--afw-navbar-height);
|
|
325
|
+
left: 0;
|
|
326
|
+
right: 0;
|
|
327
|
+
display: flex;
|
|
328
|
+
flex-direction: column;
|
|
329
|
+
padding: 0.5rem 1rem 1rem;
|
|
330
|
+
background: var(--afw-bg);
|
|
331
|
+
border-bottom: 1px solid var(--afw-border);
|
|
332
|
+
box-shadow: 0 12px 24px -16px rgb(0 0 0 / 0.35);
|
|
333
|
+
}
|
|
334
|
+
.afwd-navbar-menu .afwd-navbar-link {
|
|
335
|
+
padding: 0.7rem 0.25rem;
|
|
336
|
+
font-size: 1rem;
|
|
337
|
+
}
|
|
338
|
+
.afwd-navbar-menu .afwd-navbar-link::after {
|
|
339
|
+
display: none;
|
|
340
|
+
}
|
|
341
|
+
.afwd-navbar-menu .afwd-navbar-link + .afwd-navbar-link {
|
|
342
|
+
border-top: 1px solid var(--afw-border);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/* Hidden unless the mobile rule above shows it; the menu never shows on wide screens. */
|
|
346
|
+
.afwd-navbar-menu-toggle {
|
|
347
|
+
display: none;
|
|
348
|
+
}
|
|
349
|
+
@media (min-width: 768px) {
|
|
350
|
+
.afwd-navbar-menu {
|
|
351
|
+
display: none;
|
|
316
352
|
}
|
|
317
353
|
}
|
|
318
354
|
|
|
@@ -1262,6 +1298,7 @@
|
|
|
1262
1298
|
|
|
1263
1299
|
/* ── Page meta (last updated · edit link) ──────────────────────────────────── */
|
|
1264
1300
|
.afwd-page-meta {
|
|
1301
|
+
max-width: var(--afw-content-max); /* aligned with the article above */
|
|
1265
1302
|
display: flex;
|
|
1266
1303
|
align-items: center;
|
|
1267
1304
|
justify-content: space-between;
|
|
@@ -1299,6 +1336,7 @@
|
|
|
1299
1336
|
|
|
1300
1337
|
/* ── Pagination ────────────────────────────────────────────────────────────── */
|
|
1301
1338
|
.afwd-pagination {
|
|
1339
|
+
max-width: var(--afw-content-max);
|
|
1302
1340
|
display: flex;
|
|
1303
1341
|
justify-content: space-between;
|
|
1304
1342
|
gap: 1rem;
|