forked from quoid/userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotification.svelte
More file actions
81 lines (70 loc) · 1.88 KB
/
Copy pathNotification.svelte
File metadata and controls
81 lines (70 loc) · 1.88 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
81
<script>
// inspired by https://github.com/zerodevx/svelte-toast
import {fade, fly} from "svelte/transition";
import IconButton from "../../shared/Components/IconButton.svelte";
import iconClose from "../../shared/img/icon-close.svg";
import iconError from "../../shared/img/icon-error.svg";
import iconInfo from "../../shared/img/icon-info.svg";
import iconWarn from "../../shared/img/icon-warn.svg";
export let item;
const icon = item.type === "error" ? iconError : item.type === "info" ? iconInfo : iconWarn;
</script>
<style>
li {
align-items: center;
background-color: var(--color-black);
border: 1px solid black;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
color: var(--text-color-secondary);
display: flex;
font: var(--text-medium);
margin-bottom: 0.5rem;
padding: 0.5rem 1rem;
}
div {
align-items: center;
display: flex;
flex-shrink: 0;
height: 1.5rem;
justify-content: center;
width: 1.5rem;
}
.error div {
color: var(--color-red);
}
.info div {
color: var(--color-blue);
}
.warn div {
color: var(--color-yellow);
}
div :global(svg) {
fill: currentColor;
height: auto;
pointer-events: none;
width: 66.7%;
}
li:last-child {
margin-bottom: 0;
}
span {
flex-grow: 1;
margin: 0 1rem 0 0.25rem;
}
li :global(button) {
flex-shrink: 0;
width: 1rem;
}
</style>
<li
class:error={item.type === "error"}
class:info={item.type === "info"}
class:warn={item.type === "warn"}
in:fly={{y: 24, duration: 150}}
out:fade={{duration: 150}}
>
<div>{@html icon}</div>
<span>{item.message}</span>
<IconButton icon={iconClose} on:click/>
</li>