diff --git a/src/lib/components/Loading.svelte b/src/lib/components/Loading.svelte new file mode 100644 index 0000000..dff3978 --- /dev/null +++ b/src/lib/components/Loading.svelte @@ -0,0 +1,30 @@ + + +
+
+
+
+
+ + diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5c85e36..a8a1f52 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -10,8 +10,10 @@ import { Toaster } from '$lib/components/ui/sonner'; import { onMount } from 'svelte'; import { afterNavigate, beforeNavigate } from '$app/navigation'; + import Loading from '$lib/components/Loading.svelte'; let root: HTMLElement | null; + let navigating = false; onMount(() => { root = document.getElementsByTagName('html')[0]; @@ -20,10 +22,12 @@ }); beforeNavigate(() => { + navigating = true; root?.classList.remove('smoothscroll'); }); afterNavigate(() => { + navigating = false; root?.classList.add('smoothscroll'); }); @@ -31,6 +35,10 @@ +{#if navigating} + +{/if} +