|
1 | | -<script> |
| 1 | +<script lang="ts"> |
2 | 2 | import MainLayout from './MainLayout.svelte' |
3 | | - import { AppBar } from '@skeletonlabs/skeleton' |
| 3 | + import { AppBar, AppShell } from '@skeletonlabs/skeleton' |
4 | 4 | import { page, inertia, useForm } from '@inertiajs/svelte' |
5 | | - import { LightSwitch } from '@skeletonlabs/skeleton' |
| 5 | + import { LightSwitch, Drawer, drawerStore } from '@skeletonlabs/skeleton' |
| 6 | + import UserSidebar from '@/Components/UserSidebar.svelte' |
6 | 7 |
|
7 | 8 | $: auth = $page.props.auth.user |
8 | 9 |
|
|
13 | 14 |
|
14 | 15 | $form.post(route('logout')) |
15 | 16 | } |
| 17 | +
|
| 18 | + function drawerOpen(): void { |
| 19 | + drawerStore.open({}) |
| 20 | + } |
16 | 21 | </script> |
17 | 22 |
|
18 | 23 | <MainLayout> |
19 | | - <svelte:fragment slot="header"> |
20 | | - <div class="bg-surface-100-800-token"> |
21 | | - <div class="container"> |
22 | | - <AppBar background="bg-transparent"> |
23 | | - <svelte:fragment slot="lead"> |
24 | | - <a href={route('user.dashboard')} use:inertia> |
25 | | - <strong class="text-xl uppercase">{$page.props.siteName}</strong> |
26 | | - </a> |
27 | | - </svelte:fragment> |
28 | | - |
29 | | - <svelte:fragment slot="trail"> |
30 | | - <LightSwitch /> |
31 | | - |
32 | | - <form on:submit|preventDefault={handleLogout}> |
33 | | - <button type="submit" class="btn btn-sm variant-ghost-surface"> Logout </button> |
34 | | - </form> |
35 | | - |
36 | | - <a class="btn btn-sm variant-ghost-surface" href="/dashboard" use:inertia> Profile </a> |
37 | | - </svelte:fragment> |
38 | | - </AppBar> |
| 24 | + <AppShell |
| 25 | + slotSidebarLeft="bg-surface-500/5 w-0 lg:w-64" |
| 26 | + regionPage="overflow-y-auto relative h-screen scrollbar-hidden" |
| 27 | + > |
| 28 | + <svelte:fragment slot="header"> |
| 29 | + <div class="bg-surface-100-800-token"> |
| 30 | + <div class="container"> |
| 31 | + <AppBar background="bg-transparent"> |
| 32 | + <svelte:fragment slot="lead"> |
| 33 | + <button class="lg:hidden btn btn-sm mr-4" on:click={drawerOpen}> |
| 34 | + <span> |
| 35 | + <svg viewBox="0 0 100 80" class="fill-token w-4 h-4"> |
| 36 | + <rect width="100" height="20" /> |
| 37 | + <rect y="30" width="100" height="20" /> |
| 38 | + <rect y="60" width="100" height="20" /> |
| 39 | + </svg> |
| 40 | + </span> |
| 41 | + </button> |
| 42 | + <a href={route('user.dashboard')} use:inertia> |
| 43 | + <strong class="text-xl uppercase">{$page.props.siteName}</strong> |
| 44 | + </a> |
| 45 | + </svelte:fragment> |
| 46 | + |
| 47 | + <svelte:fragment slot="trail"> |
| 48 | + <LightSwitch /> |
| 49 | + |
| 50 | + <form on:submit|preventDefault={handleLogout}> |
| 51 | + <button type="submit" class="btn btn-sm variant-ghost-surface"> Logout </button> |
| 52 | + </form> |
| 53 | + |
| 54 | + <span class="hidden lg:block"> |
| 55 | + <a class="btn btn-sm variant-ghost-surface" href="/dashboard" use:inertia> Profile </a> |
| 56 | + </span> |
| 57 | + </svelte:fragment> |
| 58 | + </AppBar> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + </svelte:fragment> |
| 62 | + |
| 63 | + <!-- sidebar --> |
| 64 | + <Drawer regionDrawer="mt-16 w-56 pb-16"> |
| 65 | + <UserSidebar /> |
| 66 | + </Drawer> |
| 67 | + |
| 68 | + <svelte:fragment slot="sidebarLeft"> |
| 69 | + <div id="sidebar-left" class="hidden lg:block"> |
| 70 | + <div class="overflow-y-auto h-screen"> |
| 71 | + <UserSidebar /> |
| 72 | + </div> |
39 | 73 | </div> |
40 | | - </div> |
41 | | - </svelte:fragment> |
| 74 | + </svelte:fragment> |
42 | 75 |
|
43 | | - <!-- content --> |
44 | | - <slot /> |
| 76 | + <!-- content --> |
| 77 | + <slot /> |
| 78 | + <div class="my-4" /> |
| 79 | + </AppShell> |
45 | 80 | </MainLayout> |
0 commit comments