34 lines
862 B
TypeScript
34 lines
862 B
TypeScript
export const html = String.raw;
|
|
|
|
const Layout = (content: string) => {
|
|
return html`<html>
|
|
<head>
|
|
<title>Joe</title>
|
|
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css" />
|
|
<meta charset="utf-8" />
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<nav>
|
|
<a href="/"><code>/</code></a>
|
|
<a href="/applications">Applications</a>
|
|
</nav>
|
|
</header>
|
|
<main>${content}</main>
|
|
|
|
<script>
|
|
// add class "current" to all links matching the current URL
|
|
const links = document.querySelectorAll("a");
|
|
const currentUrl = window.location.pathname;
|
|
links.forEach((link) => {
|
|
if (link.getAttribute("href") === currentUrl) {
|
|
link.classList.add("current");
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>`;
|
|
};
|
|
|
|
export default Layout;
|