feat: add transitions

This commit is contained in:
EETagent 2022-11-20 15:13:13 +01:00
parent 5c089f4dd1
commit cd281a0d7d
3 changed files with 29 additions and 1 deletions

View file

@ -0,0 +1,14 @@
<script>
import { fly } from 'svelte/transition';
export let url = '';
</script>
{#key url}
<div
in:fly={{ x: -5, duration: 500, delay: 500 }}
out:fly={{ x: 5, duration: 500 }}
class="absolute bg-inherit w-full"
>
<slot />
</div>
{/key}

View file

@ -0,0 +1,6 @@
/** @type {import('./$types').PageLoad} */
export const load = async ({ url }) => {
return {
url: url.pathname
};
};

View file

@ -1,3 +1,9 @@
<script lang="ts">
import PageTransition from '$lib/components/PageTransition.svelte';
export let data: { url: string };
</script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
@ -5,7 +11,9 @@
rel="stylesheet"
/>
<slot />
<PageTransition url={data.url}>
<slot />
</PageTransition>
<style windi:preflights:global windi:safelist:global>
:global(html) {