forked from quoid/userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathView.svelte
More file actions
80 lines (72 loc) · 2.05 KB
/
Copy pathView.svelte
File metadata and controls
80 lines (72 loc) · 2.05 KB
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>
import {quintInOut} from "svelte/easing";
import IconButton from "../../shared/Components/IconButton.svelte";
import Loader from "../../shared/Components/Loader.svelte";
import iconArrowLeft from "../../shared/img/icon-arrow-left.svg";
export let loading = false;
export let headerTitle = "View Header";
export let closeClick;
export let showLoaderOnDisabled = true;
export let abort = false;
export let abortClick = () => {};
function slide(node, params) {
return {
delay: params.delay || 0,
duration: params.duration || 150,
easing: params.easing || quintInOut,
css: t => `transform: translateX(${(t-1)*18}rem);`
};
}
</script>
<div class="view" transition:slide>
<div class="view__header">
{headerTitle}
<IconButton
icon={iconArrowLeft}
title={"Go back"}
on:click={closeClick}
/>
</div>
<div class="view__body">
{#if loading && showLoaderOnDisabled}
<Loader backgroundColor="var(--color-bg-primary)" {abortClick} {abort}/>
{:else}
<slot><div>Slot content is required...</div></slot>
{/if}
</div>
</div>
<style>
.view {
background-color: var(--color-bg-primary);
display: flex;
flex-direction: column;
height: 100%;
left: 0;
position: absolute;
text-align: center;
top: 0;
width: 100%;
z-index: 3;
}
.view__header {
background-color: var(--color-bg-primary);
border-bottom: 1px solid var(--color-black);
flex-shrink: 0;
font-weight: 600;
padding: 0.5rem 1rem calc(0.5rem - 1px) 1rem;
top: 0;
}
.view :global(.loader) {
background-color: var(--color-bg-primary);
}
.view__header :global(button) {
left: 1rem;
position: absolute;
top: 0.5rem;
}
.view__body {
flex-grow: 1;
overflow-y: auto;
position: relative;
}
</style>