parent
c25ad1619d
commit
1c29d7d3ac
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@fwdekker/template",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.16",
|
||||
"description": "The base template for pages on fwdekker.com.",
|
||||
"author": "Felix W. Dekker (https://fwdekker.com)",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -58,11 +58,16 @@
|
|||
|
||||
|
||||
.nav ul li ul {
|
||||
display: none;
|
||||
/*display: none;*/
|
||||
position: absolute;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.nav ul li ul li ul {
|
||||
left: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.nav ul li:hover > ul,
|
||||
.nav ul li:focus-within > ul,
|
||||
.nav ul li ul:hover {
|
||||
|
@ -70,5 +75,6 @@
|
|||
}
|
||||
|
||||
.nav ul li ul li {
|
||||
min-width: 7em;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -61,15 +61,18 @@ export const nav = function () {
|
|||
* Unpacks a navigation entry returned from the navigation API into an HTML element.
|
||||
*
|
||||
* @param entry {Object} the entry to unpack
|
||||
* @param [depth] {Object} the current nesting level
|
||||
* @returns {HTMLElement} the navigation list entry as HTML, described by its children
|
||||
*/
|
||||
const unpackEntry = function (entry) {
|
||||
const unpackEntry = function (entry, depth = 0) {
|
||||
if (entry.entries.length === 0)
|
||||
return h("li", h("a", {href: entry.link, innerHTML: entry.name}));
|
||||
|
||||
const arrow = depth === 0 ? "▾" : "▸"
|
||||
|
||||
return h("li",
|
||||
h("a", {href: entry.link, innerHTML: `${entry.name} ▾`}),
|
||||
h("ul", entry.entries.map(it => unpackEntry(it)))
|
||||
h("a", {href: entry.link, innerHTML: `${entry.name} ${arrow}`}),
|
||||
h("ul", entry.entries.map(it => unpackEntry(it, depth + 1)))
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue