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
|
|
|
html = { head, body }: ''
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
${lib.indent " " head}
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
${lib.indent " " body}
|
|
|
|
<body>
|
|
|
|
</html>
|
|
|
|
'';
|
2024-11-13 15:24:41 +01:00
|
|
|
nav = { page, menu }:
|
2024-11-13 15:24:41 +01:00
|
|
|
let
|
|
|
|
render-item = item:
|
|
|
|
if item ? menu then
|
|
|
|
''
|
|
|
|
<li>${item.menu.label}
|
2024-11-13 15:24:41 +01:00
|
|
|
${lib.indent " " (nav { inherit page; menu = item; })}
|
2024-11-13 15:24:41 +01:00
|
|
|
''
|
|
|
|
else
|
2024-11-13 15:24:41 +01:00
|
|
|
if item ? page then ''<li><a href="${page.link item.page}">${item.page.title}</a></li>''
|
2024-11-13 15:24:41 +01:00
|
|
|
else ''<li><a href="${item.link.url}">${item.link.label}</a></li>''
|
|
|
|
;
|
|
|
|
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
|
|
|
}
|