2025-01-22 04:54:03 +01:00
|
|
|
import type { Node } from "antihtml";
|
|
|
|
|
|
|
|
interface BaseProps {
|
|
|
|
title: string;
|
|
|
|
children: Node | Node[],
|
|
|
|
}
|
2025-02-02 10:37:42 +01:00
|
|
|
export default function BasePage(props: BaseProps) {
|
2025-02-03 10:30:35 +01:00
|
|
|
let reloadScript = null;
|
|
|
|
if (process.env.DEV_EVENT_PORT) {
|
|
|
|
const content = `const url = new URL("/events", location);
|
|
|
|
url.port = ${process.env.DEV_EVENT_PORT};
|
|
|
|
const source = new EventSource(url);
|
|
|
|
source.addEventListener("reload", () => location.reload());`;
|
|
|
|
reloadScript = <script type="module" defer="">{content}</script>;
|
|
|
|
}
|
2025-01-22 04:54:03 +01:00
|
|
|
return <html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<title>{props.title}</title>
|
2025-02-02 13:48:59 +01:00
|
|
|
<meta name="viewport" content="width=device-width" />
|
2025-02-03 13:32:15 +01:00
|
|
|
<link rel="stylesheet" href="/assets/styles/base.css" />
|
|
|
|
<script type="module" defer="" src="/assets/scripts/viewport.js" />
|
2025-02-03 10:30:35 +01:00
|
|
|
{ reloadScript }
|
2025-01-22 04:54:03 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header class="header">
|
|
|
|
<nav>
|
2025-02-03 12:57:04 +01:00
|
|
|
<a href="/about.html">About</a>
|
2025-01-25 08:55:26 +01:00
|
|
|
<a href="/updates.html">Updates</a>
|
|
|
|
<a href="/words.html">Words</a>
|
|
|
|
<a href="/projects.html">Projects</a>
|
2025-01-25 10:46:08 +01:00
|
|
|
<a href="/links.html">Links</a>
|
2025-01-22 04:54:03 +01:00
|
|
|
</nav>
|
|
|
|
</header>
|
|
|
|
{props.children}
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
}
|