blob: 15ebdf43050a049778b637f0b545f22c1cc5773a (
plain) (
blame)
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
|
<script lang="ts">
import { trapFocus } from '$lib/Actions';
import { getReaderContext } from '$lib/Reader';
import { fadeDefault, slideXDefault } from '$lib/Transitions';
import { fade, slide } from 'svelte/transition';
import CloseReaderButton from './components/CloseReaderButton.svelte';
import PageIndicator from './components/PageIndicator.svelte';
import ReaderMenuButton from './components/ReaderMenuButton.svelte';
const reader = getReaderContext();
</script>
{#if $reader.visible}
<div
role="dialog"
class="fixed bottom-0 left-0 right-0 top-0 z-10 flex h-full w-full bg-black"
transition:fade={fadeDefault}
use:trapFocus
>
{#if $$slots.sidebar && $reader.sidebar}
<aside class="w-[36rem] shrink-0 bg-slate-800" transition:slide={slideXDefault}>
<div class="flex h-full min-w-[36rem] flex-col gap-4 overflow-auto p-4">
<slot name="sidebar" />
</div>
</aside>
{/if}
<main class="relative flex grow">
<div class="absolute z-10 flex w-full p-1 text-lg [&>*:last-child]:ml-auto">
{#if $$slots.sidebar}
<ReaderMenuButton />
{/if}
<CloseReaderButton />
</div>
<div class="absolute bottom-0 right-0 z-10 flex p-1 text-lg">
<PageIndicator />
</div>
<div class="flex grow">
<slot />
</div>
</main>
</div>
{/if}
|