Files
archtika/web-app/src/routes/+layout.svelte

76 lines
1.4 KiB
Svelte
Raw Normal View History

<script lang="ts">
2024-08-02 15:33:18 +02:00
import "../app.css";
import { page } from "$app/stores";
const { data, children } = $props();
2024-08-01 18:09:35 +02:00
const isProjectRoute = $derived($page.url.pathname.startsWith("/website"));
2024-08-02 15:33:18 +02:00
const routeName = $derived(
$page.url.pathname === "/"
? "Dashboard"
: `${$page.url.pathname.charAt(1).toUpperCase()}${$page.url.pathname.slice(2)}`
);
</script>
<nav>
2024-08-01 18:09:35 +02:00
<strong>archtika</strong>
{#if data.user}
2024-08-01 18:09:35 +02:00
<a href="/">Dashboard</a>
<a href="/account">Account</a>
{:else}
<a href="/register">Register</a>
<a href="/login">Login</a>
{/if}
</nav>
2024-08-01 18:09:35 +02:00
{#if !isProjectRoute}
<header>
2024-08-02 15:33:18 +02:00
<h1>{routeName}</h1>
2024-08-01 18:09:35 +02:00
</header>
{/if}
2024-08-01 18:09:35 +02:00
<main class:editor={isProjectRoute}>
{@render children()}
</main>
<footer>
<p>
2024-08-01 18:09:35 +02:00
<small>archtika is a free, open, modern, performant and lightweight CMS</small>
</p>
</footer>
2024-08-01 18:09:35 +02:00
<style>
nav,
header,
main,
footer {
padding-block: 1rem;
inline-size: min(100% - 2rem, 1024px);
margin-inline: auto;
}
2024-08-02 15:33:18 +02:00
nav {
display: flex;
align-items: center;
gap: 1rem;
overflow-x: auto;
}
nav > *:first-child {
margin-inline-end: auto;
}
2024-08-01 18:09:35 +02:00
footer {
text-align: center;
2024-08-02 15:33:18 +02:00
margin-block-start: auto;
2024-08-01 18:09:35 +02:00
}
.editor {
inline-size: min(100% - 2rem, 1536px);
block-size: calc(100vh - 7rem);
2024-08-03 13:49:41 +02:00
border-block-start: var(--border-primary);
display: grid;
grid-template-columns: 1fr 1fr;
2024-08-01 18:09:35 +02:00
padding-block: 0;
}
</style>