Page Transitions!
This commit is contained in:
parent
9750c8f5cd
commit
79422e065e
2 changed files with 18 additions and 3 deletions
7
src/routes/+layout.js
Normal file
7
src/routes/+layout.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
export const load = ({ url }) => {
|
||||||
|
const { pathname } = url
|
||||||
|
|
||||||
|
return {
|
||||||
|
pathname
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,22 @@
|
||||||
<script>
|
<script>
|
||||||
import "../app.scss";
|
import "../app.scss";
|
||||||
import Header from "./Header.svelte";
|
import Header from "./Header.svelte";
|
||||||
|
|
||||||
|
import { fly } from 'svelte/transition'
|
||||||
|
export let data
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="app">
|
<div class="app">
|
||||||
<Header />
|
<Header />
|
||||||
|
|
||||||
<main>
|
{#key data.pathname}
|
||||||
<slot />
|
<main
|
||||||
</main>
|
in:fly={{ x: -10, duration: 250, delay: 250 }}
|
||||||
|
out:fly={{ x: 5, duration: 250 }}
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</main>
|
||||||
|
{/key}
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in a new issue