2024-11-13 15:24:41 +01:00
|
|
|
{ lib }:
|
2024-11-13 15:24:41 +01:00
|
|
|
rec {
|
2024-11-13 15:24:41 +01:00
|
|
|
nav = menu: page:
|
2024-11-13 15:24:41 +01:00
|
|
|
let
|
|
|
|
render-item = item:
|
2024-11-13 15:24:41 +01:00
|
|
|
if item ? menu then ''
|
|
|
|
<li>${item.menu.label}
|
|
|
|
${lib.indent " " (item.menu.outputs.html page)}
|
|
|
|
</li>
|
|
|
|
''
|
|
|
|
else if item ? page then ''<li><a href="${page.link item.page}">${item.page.title}</a></li>''
|
|
|
|
else ''<li><a href="${item.link.url}">${item.link.label}</a></li>''
|
2024-11-13 15:24:41 +01:00
|
|
|
;
|
|
|
|
in
|
|
|
|
''
|
|
|
|
<nav>
|
|
|
|
<ul>
|
2024-11-13 15:24:41 +01:00
|
|
|
${with lib; indent " " (join "\n" (map render-item menu.menu.items))}
|
2024-11-13 15:24:41 +01:00
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
'';
|
2024-11-13 15:24:41 +01:00
|
|
|
}
|