[ui] jobs' progress bar can also be indefinite

feat/vaults
Tomáš Mládek 2022-02-19 16:57:18 +01:00
parent 5a393b4ec0
commit a4a5ab7f32
No known key found for this signature in database
GPG Key ID: 65E225C8B3E2ED8A
3 changed files with 34 additions and 7 deletions

View File

@ -47,9 +47,7 @@
{#each activeJobs as job (job.id)}
<div class="job" transition:fade>
<div class="job-label">{job.title}</div>
<ProgessBar value={job.progress}>
{Math.round(job.progress)}%
</ProgessBar>
<ProgessBar value={job.progress} />
</div>
{/each}

View File

@ -1,12 +1,18 @@
<script lang="ts">
export let value: number;
export let value: number | undefined = undefined;
</script>
<div class="progress-bar" style="--value: {value}%">
<div
class="progress-bar"
class:indeterminate={value == undefined}
style="--value: {value}%"
>
<div class="value" />
<div class="label">
<slot>
{value}%
{#if value}
{Math.round(value)}%
{/if}
</slot>
</div>
</div>
@ -22,7 +28,7 @@
.value {
background: var(--primary);
height: 100%;
width: var(--value);
width: var(--value, 100%);
transition: width 0.2s ease;
}
@ -43,4 +49,25 @@
font-weight: bold;
mix-blend-mode: difference;
}
.progress-bar.indeterminate {
.value {
animation-name: indeterminate;
animation-duration: 2s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}
}
@keyframes indeterminate {
0% {
background-color: var(--primary);
}
50% {
background-color: var(--primary-lighter);
}
100% {
background-color: var(--primary);
}
}
</style>

View File

@ -1,4 +1,5 @@
@use "colors";
@use "sass:color";
@mixin rebase(
$rebase03,
@ -16,6 +17,7 @@
--background: #{$rebase03};
--background-lighter: #{$rebase02};
--primary: #{colors.$blue};
--primary-lighter: #{color.adjust(colors.$blue, $lightness: 25%)};
background-color: $rebase03;
color: $rebase0;