Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Simple fade-out/fade-in route transition in sapper #902

Open
@rchrdnsh

Description

@rchrdnsh

Just spun up an instance of the the starter svelte template and I'm trying to add a simple fade-out/fade-in route transition from route to route. I did this to the _layout.svelte component:

<script>
  import Nav from '../components/Nav.svelte';

  export let segment;

  import { fade } from 'svelte/transition';
  let visible = true;
</script>

<style>
  main {
    position: relative;
    max-width: 56em;
    background-color: rgb(197, 197, 197);
    padding: 2em;
    margin: 0 auto;
    box-sizing: border-box:
  }
</style>

<Nav {segment}/>

{#if visible}
  <main>
    <slot></slot>
  </main>	
{/if}

...and it did not work, so I'm wondering what the correct approach would be to make this work. I got this idea from the svelte 3 tutorial, and I also tried wrapping only the <slot> and that did not seem to work either.

Thank you! 🤗

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions