2023-07-26 13:47:01 +02:00
|
|
|
import { ComponentChildren } from "preact";
|
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
children: ComponentChildren;
|
|
|
|
title?: string;
|
|
|
|
name?: string;
|
2023-07-30 21:43:09 +02:00
|
|
|
url: URL;
|
2023-07-26 13:47:01 +02:00
|
|
|
description?: string;
|
|
|
|
};
|
|
|
|
|
2023-07-30 21:43:09 +02:00
|
|
|
export const MainLayout = ({ children, url }: Props) => {
|
|
|
|
const menu = [
|
|
|
|
{
|
|
|
|
name: "🏡 Home",
|
|
|
|
link: "/",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "🍽️ Recipes",
|
|
|
|
link: "/recipes",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "🍿 Movies",
|
|
|
|
link: "/movies",
|
|
|
|
},
|
2023-08-01 21:35:21 +02:00
|
|
|
{
|
|
|
|
name: "📝 Articles",
|
|
|
|
link: "/articles",
|
|
|
|
},
|
2023-07-30 21:43:09 +02:00
|
|
|
];
|
|
|
|
|
2023-07-26 13:47:01 +02:00
|
|
|
return (
|
2023-07-31 17:21:17 +02:00
|
|
|
<div
|
|
|
|
class="md:grid mx-auto"
|
|
|
|
style={{ gridTemplateColumns: "200px 1fr", maxWidth: "1024px" }}
|
|
|
|
>
|
2023-07-30 21:43:09 +02:00
|
|
|
<aside class="p-4 hidden md:block">
|
2023-07-31 17:21:17 +02:00
|
|
|
<nav class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0">
|
2023-07-30 21:43:09 +02:00
|
|
|
{menu.map((m) => {
|
|
|
|
return (
|
|
|
|
<a
|
|
|
|
href={m.link}
|
|
|
|
class={`block ${
|
|
|
|
m.link === url.pathname ? "bg-white text-black" : "text-white"
|
|
|
|
} p-3 text-xl w-full rounded-2xl`}
|
|
|
|
>
|
|
|
|
{m.name}
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</nav>
|
|
|
|
</aside>
|
2023-07-26 13:47:01 +02:00
|
|
|
<main
|
2023-07-30 21:43:09 +02:00
|
|
|
class="py-5"
|
2023-07-26 13:47:01 +02:00
|
|
|
style={{ fontFamily: "Work Sans" }}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</main>
|
2023-07-30 21:43:09 +02:00
|
|
|
</div>
|
2023-07-26 13:47:01 +02:00
|
|
|
);
|
|
|
|
};
|