<script lang="ts">
	import '../app.css';
	import { page } from '$app/stores';
	import { name } from '$content/metadata.json';
	import Footer from "./Footer.svelte";
	import Navbar from "./Navbar.svelte";
	import PageTransition from "./PageTransition.svelte";

	export let data : { url: string };
</script>

<!-- Homepage has its own navbar with animations -->
{#if $page.url.pathname != "/"}
	<div id="layout">
		<div id="nav">
			<p id="bio-name">{name}</p>
			<Navbar />
			<slot name="header" />
		</div>
		<main>
			<PageTransition url={data.url}>
				<slot />
			</PageTransition>
			<Footer />
		</main>
	</div>
{:else}
	<!-- On the home page -->
	<PageTransition url={data.url}>
		<slot />
	</PageTransition>
	<Footer />
{/if}

<style>
	#bio-name {
		font-family: serif;
		font-size: 3rem;
		font-weight: normal;
		color: var(--name);
	}
	#layout {
		max-width: max(80vw, 100vh);
		margin-left: auto;
		margin-right: auto;
		margin-top: 50px;
		gap: 100px;
		display: flex;
		justify-content: center;
		/*
		display: grid;
		grid-template-columns: 1fr 3fr;
		grid-template-areas:
			"nav content"
			;
		*/
	}
	@media (max-width: 700px) {
		#layout {
			flex-direction: column;
			margin-top: 10px;
			gap: 20px;
		}
	}
	main {
		width: min(100vw, max(50vw, 100vh));
		grid-area: content;
	}
	#nav {
		align-self: right;
		padding-left: 10px;
		grid-area: nav;
	}
</style>
