@riebeckite/plugin-navigation 0.0.24 → 0.0.25
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/dist/components/site-nav.d.ts +2 -2
- package/dist/index.js +8 -2
- package/package.json +4 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { NavigationItem } from "../src/types.js";
|
|
2
2
|
export type SiteNavProps = {
|
|
3
3
|
/** Navigation tree to render, in order. */
|
|
4
|
-
readonly items
|
|
4
|
+
readonly items?: readonly NavigationItem[];
|
|
5
5
|
/** Current request path, used to mark the active item. */
|
|
6
|
-
readonly path
|
|
6
|
+
readonly path?: string;
|
|
7
7
|
/**
|
|
8
8
|
* Current content language. When set, a matching `/language` prefix is
|
|
9
9
|
* stripped from `path` before the active item is resolved.
|
package/dist/index.js
CHANGED
|
@@ -159,8 +159,14 @@ function isRecord(value) {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
// components/site-nav.tsx
|
|
162
|
+
import { useSiteContext } from "@riebeckite/ui";
|
|
162
163
|
import { jsx, jsxs } from "hono/jsx/jsx-runtime";
|
|
163
164
|
function SiteNav(props) {
|
|
165
|
+
const site = useSiteContext();
|
|
166
|
+
const navigation2 = site ? resolveSiteNavigation(site.config, site.manifest, props.language) : null;
|
|
167
|
+
const items = props.items ?? navigation2?.primary ?? [];
|
|
168
|
+
const path = props.path ?? site?.path ?? "/";
|
|
169
|
+
if (items.length === 0 && props.items === void 0) return null;
|
|
164
170
|
return /* @__PURE__ */ jsx(
|
|
165
171
|
"nav",
|
|
166
172
|
{
|
|
@@ -169,8 +175,8 @@ function SiteNav(props) {
|
|
|
169
175
|
children: /* @__PURE__ */ jsx(
|
|
170
176
|
NavigationItems,
|
|
171
177
|
{
|
|
172
|
-
items
|
|
173
|
-
path
|
|
178
|
+
items,
|
|
179
|
+
path,
|
|
174
180
|
language: props.language,
|
|
175
181
|
localizeHref: props.localizeHref
|
|
176
182
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-navigation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"hono": "^4.12.25",
|
|
19
|
-
"@riebeckite/core": "0.0.
|
|
19
|
+
"@riebeckite/core": "0.0.25",
|
|
20
|
+
"@riebeckite/ui": "0.0.25"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"tsx": "^4.22.4",
|
|
23
|
-
"@riebeckite/test": "0.0.
|
|
24
|
+
"@riebeckite/test": "0.0.25"
|
|
24
25
|
},
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"access": "public"
|