feat: add transition to page routing

This commit is contained in:
Bart van der Braak 2023-08-18 11:03:38 +02:00
parent c380518eda
commit fda17a78f0
2 changed files with 17 additions and 1 deletions

View file

@ -5,6 +5,11 @@
import Footer from '../lib/components/Footer.svelte';
import Navigation from '../lib/components/Navigation.svelte';
import Header from '$lib/components/Header.svelte';
import { fade } from 'svelte/transition';
export let data;
$: ({ pathname } = data);
import { dev } from '$app/environment';
import { inject } from '@vercel/analytics';
@ -47,7 +52,11 @@
<Header {progress} />
</svelte:fragment>
<slot />
{#key pathname}
<div in:fade={{ duration: 300, delay: 400 }} out:fade={{ duration: 300 }}>
<slot />
</div>
{/key}
<svelte:fragment slot="pageFooter">
<Footer />

7
src/routes/+layout.ts Normal file
View file

@ -0,0 +1,7 @@
export const load = ({ url }) => {
const { pathname } = url;
return {
pathname
};
};