feat: reset guestbook entries anim when switching pages
This commit is contained in:
parent
ac7f726d88
commit
e76d8fba3c
@ -1,8 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Layout from "../routes/+layout.svelte";
|
|
||||||
|
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let iconUri: string = '';
|
export let iconUri: string = '';
|
||||||
|
export let id: string = '';
|
||||||
|
|
||||||
const scaleKeyframes = [
|
const scaleKeyframes = [
|
||||||
"window-open",
|
"window-open",
|
||||||
@ -26,6 +25,7 @@
|
|||||||
bg-ralsei-black
|
bg-ralsei-black
|
||||||
animate-{chosenKeyframe}
|
animate-{chosenKeyframe}
|
||||||
"
|
"
|
||||||
|
{id}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="
|
class="
|
||||||
|
@ -4,6 +4,14 @@
|
|||||||
export let data;
|
export let data;
|
||||||
$: hasPreviousPage = data.page > 1;
|
$: hasPreviousPage = data.page > 1;
|
||||||
$: hasNextPage = data.hasNext;
|
$: hasNextPage = data.hasNext;
|
||||||
|
|
||||||
|
function resetEntriesAnimation() {
|
||||||
|
var el = document.getElementById('guestbookentries');
|
||||||
|
if (el === null) { return }
|
||||||
|
el.style.animation = 'none';
|
||||||
|
el.offsetHeight; /* trigger reflow */
|
||||||
|
el.style.animation = '';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col-reverse md:flex-row gap-2 md:gap-4">
|
<div class="flex flex-col-reverse md:flex-row gap-2 md:gap-4">
|
||||||
@ -55,7 +63,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</Window>
|
</Window>
|
||||||
<div class="grow" />
|
<div class="grow" />
|
||||||
<Window title="entries" iconUri="/icons/entries.png">
|
<Window id='guestbookentries' title="entries" iconUri="/icons/entries.png">
|
||||||
<div class="flex flex-col gap-2 md:gap-4 2xl:w-[60ch]">
|
<div class="flex flex-col gap-2 md:gap-4 2xl:w-[60ch]">
|
||||||
{#if data.getRatelimited}
|
{#if data.getRatelimited}
|
||||||
<p class="text-error">
|
<p class="text-error">
|
||||||
@ -95,6 +103,7 @@
|
|||||||
<div class="flex flex-row w-full justify-center items-center font-monospace">
|
<div class="flex flex-row w-full justify-center items-center font-monospace">
|
||||||
{#if hasPreviousPage}
|
{#if hasPreviousPage}
|
||||||
<a href="/guestbook/?page={data.entries.length > 0 ? data.page - 1 : 1}"
|
<a href="/guestbook/?page={data.entries.length > 0 ? data.page - 1 : 1}"
|
||||||
|
on:click={resetEntriesAnimation}
|
||||||
><< previous</a
|
><< previous</a
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
@ -102,7 +111,7 @@
|
|||||||
<div class="w-1/12" />
|
<div class="w-1/12" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if hasNextPage}
|
{#if hasNextPage}
|
||||||
<a href="/guestbook/?page={data.page + 1}">next >></a>
|
<a href="/guestbook/?page={data.page + 1}" on:click={resetEntriesAnimation}>next >></a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user