1
0
resumarkdown/src/lib/components/nav-tree.svelte

51 lines
957 B
Svelte
Raw Normal View History

2024-10-12 00:53:39 -05:00
<script lang="ts">
2024-10-16 12:36:50 -05:00
import { type Snippet } from 'svelte';
import { slide } from 'svelte/transition';
2024-10-12 12:33:05 -05:00
2024-10-12 00:53:39 -05:00
import NavToggle from './nav-toggle.svelte';
2024-10-16 12:36:50 -05:00
interface Props {
mobile?: boolean;
children: Snippet;
}
let { mobile = true, children }: Props = $props();
2024-10-12 00:53:39 -05:00
2024-10-16 12:36:50 -05:00
let open: boolean = $state(false);
2024-10-12 00:53:39 -05:00
</script>
2024-10-12 23:47:09 -05:00
<nav>
{#if mobile}
<NavToggle bind:navOpen={open} />
{/if}
{#if open || !mobile}
<ul role="tablist" transition:slide={{ duration: 300 }}>
2024-10-16 12:36:50 -05:00
{@render children()}
</ul>
{/if}
2024-10-11 00:23:32 -05:00
</nav>
<style lang="less">
2024-10-12 23:47:09 -05:00
nav {
grid-area: navtree;
}
2024-10-11 00:23:32 -05:00
ul {
2024-10-12 11:57:58 -05:00
@border: 2px solid @color-dark;
2024-10-12 12:04:33 -05:00
2024-10-12 11:57:58 -05:00
border-bottom: @border;
2024-10-12 12:04:03 -05:00
box-sizing: border-box;
2024-10-11 00:23:32 -05:00
list-style-type: none;
margin: 0;
padding: 0;
2024-10-11 23:10:25 -05:00
@media screen and (min-width: @sizes[lg]) {
2024-10-12 23:47:09 -05:00
align-items: stretch;
2024-10-12 11:57:58 -05:00
border-right: @border;
display: flex;
2024-10-11 23:10:25 -05:00
flex-direction: row;
2024-10-12 23:47:09 -05:00
justify-content: space-between;
2024-10-11 23:10:25 -05:00
}
2024-10-11 00:23:32 -05:00
}
</style>