Fediversity/website/presentation/templates.nix

23 lines
564 B
Nix
Raw Normal View History

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>
${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
}