Files
windmill/frontend/src/lib/components/common/FileProgressBar.svelte
Faton Ramadani 5b49aa26b9 feat(frontend): s3 file upload (#2976)
* feat(frontend): wip

* feat(frontend): s3 file working

* feat(frontend): policy

* feat(frontend): policy

* feat(frontend): wip

* feat(frontend): merge main

* feat(frontend): update s3 upload logic

* feat(frontend): wip

* feat(frontend): wip

* feat(frontend): path template

* feat(frontend): done

* feat(frontend): clean up

* feat(frontend): fix dark mode

* feat(frontend): fix outputs + add component control

* feat(frontend): fix outputs + add component control

* Update components.ts

* Update components.ts

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2024-01-13 08:35:00 +01:00

59 lines
1.1 KiB
Svelte

<script lang="ts">
import { tweened } from 'svelte/motion'
import { cubicOut } from 'svelte/easing'
export let color = 'blue'
export let progress = 0
export let ended: boolean = false
const tweenedProgress = tweened(progress, {
duration: 400,
easing: cubicOut
})
$: tweenedProgress.set(progress)
</script>
{#key color}
<div class="flex flex-row gap-1 items-center justify-between w-full">
{#if ended}
<slot />
{:else}
<div class="progress-bar">
<div
class={`progress ${!ended ? 'blinking' : ''}`}
style={`--color: ${color}; width: ${$tweenedProgress}%`}
/>
</div>
<span class="text-xs p-1">{Math.round($tweenedProgress)}%</span>
{/if}
</div>
{/key}
<style>
.progress-bar {
height: 10px;
background-color: lightgray;
border-radius: 5px;
overflow: hidden;
width: 100%;
}
.progress {
height: 100%;
background-color: var(--color);
transition: width 0.4s ease-out;
}
.blinking {
animation: blink 1s linear infinite;
}
@keyframes blink {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
</style>