v5/src/components/Layout.tsx

74 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-01-23 11:16:33 -05:00
import { A } from "@solidjs/router";
import type { ParentComponent } from "solid-js";
2025-01-23 11:16:33 -05:00
function changeFavicon(newFaviconPath: string) {
const link = document.querySelector("link[rel~='icon']") as HTMLLinkElement;
if (link) {
link.href = newFaviconPath;
} else {
const newLink = document.createElement("link");
newLink.rel = "icon";
newLink.href = newFaviconPath;
document.head.appendChild(newLink);
}
}
2025-01-23 11:16:33 -05:00
export const Layout: ParentComponent = (props) => {
return (
<>
<a href="#main-content" class="sr-only">
Skip to main content
</a>
2025-01-29 17:35:25 -05:00
<div class="bg-nord-6 flex flex-col min-h-screen pt-2v py-1v px-2h max-w-full mx-auto relative overflow-x-hidden leading-1 box-border decoration-2 underline-offset-2">
2025-01-23 11:16:33 -05:00
<header class="flex flex-col items-center justify-center gap-2v px-4h py-2v">
2025-01-29 17:35:25 -05:00
<a href="/" class="text-nord-3 text-2v leading-2 font-bold">
2025-01-29 23:25:18 -05:00
~/minh
2025-01-23 11:16:33 -05:00
</a>
2025-01-29 17:35:25 -05:00
<nav class="container mx-auto px-4 py-4">
<ul class="flex flex-wrap justify-center items-center gap-6">
2025-01-29 23:25:18 -05:00
<A
end
class="hover:underline hover:text-nord10"
activeClass="font-bold"
href={"/"}
>
2025-01-23 11:16:33 -05:00
Home
</A>
<A
end
2025-01-29 23:25:18 -05:00
class="hover:underline hover:text-nord10"
2025-01-23 11:16:33 -05:00
activeClass="font-bold"
href={"/articles"}
>
Articles
</A>
<A
end
2025-01-29 23:25:18 -05:00
class="hover:underline hover:text-nord10"
2025-01-23 11:16:33 -05:00
activeClass="font-bold"
href={"/tags"}
>
Tags
</A>
2025-01-29 23:25:18 -05:00
<A
class="hover:text-nord10"
href="/resume.pdf"
target="_blank"
rel="noreferrer"
onClick={() => changeFavicon("./favicon.ico")}
>
2025-01-23 11:16:33 -05:00
Resume
2025-01-29 23:25:18 -05:00
</A>
2025-01-23 11:16:33 -05:00
</ul>
</nav>
</header>
<main id="main-content" class="mt-1v flex-auto">
{props.children}
</main>
</div>
</>
);
};