@riebeckite/plugin-navigation 0.0.25 → 0.0.26
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 -0
- package/dist/index.js +10 -3
- package/package.json +4 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NavigationItem } from "../src/types.js";
|
|
2
2
|
export type SiteNavProps = {
|
|
3
|
+
readonly placement?: "primary" | "secondary";
|
|
3
4
|
/** Navigation tree to render, in order. */
|
|
4
5
|
readonly items?: readonly NavigationItem[];
|
|
5
6
|
/** Current request path, used to mark the active item. */
|
|
@@ -16,6 +17,7 @@ export type SiteNavProps = {
|
|
|
16
17
|
/** Extra classes appended to the `<nav>` landmark. */
|
|
17
18
|
readonly class?: string;
|
|
18
19
|
readonly className?: string;
|
|
20
|
+
readonly omitHome?: boolean;
|
|
19
21
|
};
|
|
20
22
|
/**
|
|
21
23
|
* Renders a resolved navigation tree as a `<nav>` landmark with nested lists.
|
package/dist/index.js
CHANGED
|
@@ -163,8 +163,15 @@ import { useSiteContext } from "@riebeckite/ui";
|
|
|
163
163
|
import { jsx, jsxs } from "hono/jsx/jsx-runtime";
|
|
164
164
|
function SiteNav(props) {
|
|
165
165
|
const site = useSiteContext();
|
|
166
|
-
const navigation2 = site ? resolveSiteNavigation(
|
|
167
|
-
|
|
166
|
+
const navigation2 = site ? resolveSiteNavigation(
|
|
167
|
+
site.config,
|
|
168
|
+
site.manifest,
|
|
169
|
+
props.language ?? site.language
|
|
170
|
+
) : null;
|
|
171
|
+
const placement = props.placement ?? "primary";
|
|
172
|
+
const items = (props.items ?? navigation2?.[placement] ?? []).filter(
|
|
173
|
+
(item) => !props.omitHome || item.href !== "/"
|
|
174
|
+
);
|
|
168
175
|
const path = props.path ?? site?.path ?? "/";
|
|
169
176
|
if (items.length === 0 && props.items === void 0) return null;
|
|
170
177
|
return /* @__PURE__ */ jsx(
|
|
@@ -177,7 +184,7 @@ function SiteNav(props) {
|
|
|
177
184
|
{
|
|
178
185
|
items,
|
|
179
186
|
path,
|
|
180
|
-
language: props.language,
|
|
187
|
+
language: props.language ?? site?.language,
|
|
181
188
|
localizeHref: props.localizeHref
|
|
182
189
|
}
|
|
183
190
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-navigation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"hono": "^4.12.25",
|
|
19
|
-
"@riebeckite/core": "0.0.
|
|
20
|
-
"@riebeckite/ui": "0.0.
|
|
19
|
+
"@riebeckite/core": "0.0.26",
|
|
20
|
+
"@riebeckite/ui": "0.0.26"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsx": "^4.22.4",
|
|
24
|
-
"@riebeckite/test": "0.0.
|
|
24
|
+
"@riebeckite/test": "0.0.26"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|