<script>
    import "../app.css";
    import logo from '$lib/assets/logo.png';

    import { AppBar } from '@skeletonlabs/skeleton';
    import { showMenu, currentUser } from '$lib/store';

    import CurrentUser from '$lib/components/CurrentUser.svelte';

    function toggleMenu() {
        showMenu.update((value) => !value);
    }
</script>

<div id="app" class="m-0 p-0 h-vh w-full">
    <div class="w-full">
        <AppBar class="app-bar">
            <svelte:fragment slot="lead">
                <a on:click|preventDefault={toggleMenu} class="cursor-pointer">
                <img class="w-8 h-8" alt="logo" src={logo} />
                </a>
            </svelte:fragment>
            <a href="/">understory</a>
            <svelte:fragment slot="trail">
                {#if $currentUser}
                    <CurrentUser />
                {/if}
            </svelte:fragment>
        </AppBar>
    </div>

    <slot />
</div>

<style>
    #app {
        margin: 0;
        padding: 0;
        height: 100vh;
        width: 100%;
    }
</style>
