/
scroll-sidebar.svelte
80 lines (77 loc) · 1.55 KB
/
scroll-sidebar.svelte
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
72
73
74
75
76
77
78
79
80
<script lang="ts">
import { Aside, Nav, SidebarList, Navbar, OutsideClick } from '$lib/index';
import { lorem, menuList, allMenuList } from './menus';
let siteName = 'Svelte-Sidebar';
let title = 'Scroll Sidebar Demo';
let asideClass =
'absolute w-auto h-screen bg-gray-200 border-r-2 shadow-lg z-50 h-screen overflow-scroll';
</script>
<div class="fixed z-50 top-0 left-0 w-full">
<OutsideClick>
<Navbar {siteName} logo="/images/svelte-sidebar-logo.png" alt="Svelte Sidebar" />
<Aside {asideClass}>
<Nav>
<h3>Side Menu</h3>
{#each menuList as { href, name, rel }}
<SidebarList {href} {name} {rel} />
{/each}
</Nav>
<Nav>
<h3>Long Side Menu</h3>
{#each allMenuList as { href, name, rel }}
<SidebarList {href} {name} {rel} />
{/each}
</Nav>
<Nav>
<h3>Long Side Menu</h3>
{#each allMenuList as { href, name, rel }}
<SidebarList {href} {name} {rel} />
{/each}
</Nav>
</Aside>
</OutsideClick>
</div>
<main class="container mx-auto py-32 px-8">
<h1 class="text-4xl text-center py-8">
{title}
</h1>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
<p class="pt-4">
{lorem}
</p>
</main>
<svelte:head>
<title>Svelte-Sidebar-Menu Scroll Sidebar Example</title>
</svelte:head>