blob: b83048c569ad1ab909c667adb7c480683d3c26c0 (
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
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
|
<script>
import { onMount } from "svelte";
import ThemeSwitcher from "./theme-switcher.svelte";
import ThemeSwitcherIcon from "./theme-switcher-icon.svelte";
import LocaleSwitcher from "./locale-switcher.svelte";
import LocaleSwitcherIcon from "./locale-switcher-icon.svelte";
import { ChevronsRightIcon, ChevronsLeftIcon } from "svelte-feather-icons";
let expanded = false;
const localeSwitcher = {
show: false,
selection: "preffered"
};
const themeSwitcher = {
show: false,
selection: "system"
};
onMount(() => {
document.addEventListener("keydown", (e) => {
if (e.code === "Escape") {
expanded = false;
}
});
document.addEventListener("click", (e) => {
if (e.target.closest("[data-blowout-toolbelt-element]") === null) {
expanded = false;
}
});
});
</script>
<style>
.blowout {
right: -80px;
}
.expanded {
right: 0 !important;
}
</style>
<aside class="blowout position-fixed bg-light inner-glow shadow-xs padding-xxs bottom-50% right-0 z-index-popover {expanded ? 'expanded' : ''}" data-blowout-toolbelt-element>
<LocaleSwitcher bind:show="{localeSwitcher.show}"
glow="{false}"
data-blowout-toolbelt-element
bind:selection="{localeSwitcher.selection}"/>
<ThemeSwitcher bind:show="{themeSwitcher.show}"
glow="{false}"
data-blowout-toolbelt-element
bind:selection="{themeSwitcher.selection}"/>
<div class="flex flex-row gap-sm justify-end">
{#if !expanded}
<div class="flex ld-switch-btn"
data-blowout-toolbelt-element
on:click={() => expanded = true}>
<ChevronsLeftIcon/>
</div>
{:else}
<div class="flex ld-switch-btn"
data-blowout-toolbelt-element
on:click={() => expanded = false}>
<ChevronsRightIcon/>
</div>
{/if}
<LocaleSwitcherIcon bind:show="{localeSwitcher.show}"
bind:selection="{localeSwitcher.selection}"/>
<ThemeSwitcherIcon bind:show="{themeSwitcher.show}"
bind:selection="{themeSwitcher.selection}"/>
</div>
</aside>
|