mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-27 14:02:14 +00:00
feat: add transitions
This commit is contained in:
parent
5c089f4dd1
commit
cd281a0d7d
3 changed files with 29 additions and 1 deletions
14
frontend/src/lib/components/PageTransition.svelte
Normal file
14
frontend/src/lib/components/PageTransition.svelte
Normal 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}
|
||||||
6
frontend/src/routes/+layout.js
Normal file
6
frontend/src/routes/+layout.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
/** @type {import('./$types').PageLoad} */
|
||||||
|
export const load = async ({ url }) => {
|
||||||
|
return {
|
||||||
|
url: url.pathname
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -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.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||||
<link
|
<link
|
||||||
|
|
@ -5,7 +11,9 @@
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<slot />
|
<PageTransition url={data.url}>
|
||||||
|
<slot />
|
||||||
|
</PageTransition>
|
||||||
|
|
||||||
<style windi:preflights:global windi:safelist:global>
|
<style windi:preflights:global windi:safelist:global>
|
||||||
:global(html) {
|
:global(html) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue