-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecryptionProgress.svelte
More file actions
109 lines (98 loc) · 2.58 KB
/
Copy pathDecryptionProgress.svelte
File metadata and controls
109 lines (98 loc) · 2.58 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<script lang="ts">
import { _ } from 'svelte-i18n'
interface props {
percentage: number | undefined
}
let { percentage }: props = $props()
let determinate = $derived(typeof percentage === 'number')
</script>
<div class="container">
<p class="label" id="decryption-progress-label">
{$_('filesharing.decryptpanel.downloadingAndDecrypting')}
</p>
{#if determinate}
<div
class="bar-track"
role="progressbar"
aria-labelledby="decryption-progress-label"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow={Math.round(
Math.max(0, Math.min(100, percentage ?? 0))
)}
>
<div
class="bar-fill"
style="width: {Math.max(0, Math.min(100, percentage ?? 0))}%"
></div>
</div>
{:else}
<div
class="bar-track"
role="progressbar"
aria-labelledby="decryption-progress-label"
aria-valuemin="0"
aria-valuemax="100"
>
<div class="bar-indeterminate"></div>
</div>
{/if}
{#if determinate}
<p class="percent">{Math.round(percentage ?? 0)}%</p>
{/if}
</div>
<style lang="scss">
.container {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
padding: 1.5rem 0;
width: 100%;
}
.label {
margin: 0;
color: var(--pg-text-secondary);
font-family: var(--pg-font-family);
font-size: var(--pg-font-size-md);
text-align: center;
}
.bar-track {
position: relative;
width: 100%;
height: 8px;
background: var(--pg-strong-background);
border-radius: 4px;
overflow: hidden;
}
.bar-fill {
height: 100%;
background: var(--pg-primary-contrast);
border-radius: 4px;
transition: width 0.15s ease-out;
}
.bar-indeterminate {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 40%;
background: var(--pg-primary-contrast);
border-radius: 4px;
animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(250%);
}
}
.percent {
margin: 0;
color: var(--pg-text-secondary);
font-family: var(--pg-font-family);
font-size: var(--pg-font-size-sm);
}
</style>