blob: e87d73195a8a5dcbb87218e73bab39776ed4fdf3 (
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
|
<script lang="ts" context="module">
import { writable, type Writable } from 'svelte/store';
interface ToolbarContext {
expand: boolean;
}
function initToolbarContext() {
return setContext<Writable<ToolbarContext>>('toolbar', writable({ expand: false }));
}
export function getToolbarContext() {
return getContext<Writable<ToolbarContext>>('toolbar');
}
</script>
<script lang="ts">
import { getContext, setContext } from 'svelte';
const toolbar = initToolbarContext();
</script>
<div class="flex flex-col">
<div
class="flex flex-row flex-wrap gap-4 text-sm xl:grid xl:grid-flow-col xl:grid-cols-[1fr_2fr_1fr]"
>
<div class="flex flex-row justify-start gap-2">
<slot name="start" />
</div>
<div class="flex flex-row flex-wrap justify-start gap-2 xl:flex-nowrap xl:justify-center">
<slot name="center" />
</div>
<div class="flex flex-row justify-end gap-2">
<slot name="end" />
</div>
</div>
{#if $toolbar.expand}
<div class="mt-4">
<slot />
</div>
{/if}
</div>
|