1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-26 05:01:05 +02:00
Files
immich/web/src/lib/components/shared-components/navigation-loading-bar.svelte
Daniel Dietzler eadcbd52fb chore: svelte 5 🎉 (#13738)
chore: svelte 5

Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
2024-11-02 10:49:07 -05:00

33 lines
756 B
Svelte

<script lang="ts">
import { onMount } from 'svelte';
import { cubicOut } from 'svelte/easing';
import { tweened } from 'svelte/motion';
let showing = false;
// delay showing any progress for a little bit so very fast loads
// do not cause flicker
const delay = 100;
const progress = tweened(0, {
duration: 1000,
easing: cubicOut,
});
function animate() {
showing = true;
void progress.set(90);
}
onMount(() => {
const timer = setTimeout(animate, delay);
return () => clearTimeout(timer);
});
</script>
{#if showing}
<div class="absolute left-0 top-0 z-[999999999] h-[3px] w-screen bg-white">
<span class="absolute h-[3px] bg-immich-primary" style:width={`${$progress}%`}></span>
</div>
{/if}