SideBar.svelte
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<script>
import { fly } from 'svelte/transition';
export let show = true;
export let side = "left";
</script>
<style>
.nav {
overflow-y: auto;
overflow-x: hidden;
}
.left {
position: fixed;
top: 0;
left: 0;
height: 100%;
border-right: 1px solid #aaa;
background: #fff;
overflow-y: auto;
width: 330px;
z-index: 900;
white-space: pre-line;
}
.right {
position: fixed;
top: 0;
right: 0;
height: 100%;
border-left: 1px solid #aaa;
background: #fff;
overflow-y: auto;
width: 330px;
z-index: 900;
}
.navtop {
display: flex;
width: 100%;
height: 60px;
background-color: white;
font-size: 30pt;
color: #AAAAAA;
justify-content: right;
padding: 5px 5px 5px;
border-bottom: #999999 solid 1px;
}
.navitems {
display: flex;
padding: 2rem 1rem 0.6rem;
flex-direction: column
}
</style>
{#if show}
<nav class={"nav " + side} transition:fly={{x: (side == "left" ? -400 : 400), opacity: 1, duration: 800}}>
<div class="navtop" on:click={() => {show = false;}}
style="justify-content:{side == "left" ? "right" : "left"}; cursor:pointer;">
{ side == "left" ? "<" : ">" }
</div>
<div class="navitems">
<slot>
</slot>
</div>
</nav>
{/if}