From 73f5cd5e7782f639d9b979124d893c72531ede01 Mon Sep 17 00:00:00 2001 From: Xylight Date: Mon, 2 Sep 2024 14:56:55 -0700 Subject: [PATCH] design: redesign pagination --- src/lib/components/ui/Pageination.svelte | 60 ++++++++++++++++------- src/lib/components/ui/layout/Shell.svelte | 20 +++++--- src/lib/i18n/en.json | 6 +++ src/routes/inbox/+page.svelte | 20 +++++--- 4 files changed, 76 insertions(+), 30 deletions(-) diff --git a/src/lib/components/ui/Pageination.svelte b/src/lib/components/ui/Pageination.svelte index e85975bd..34d8a32a 100644 --- a/src/lib/components/ui/Pageination.svelte +++ b/src/lib/components/ui/Pageination.svelte @@ -9,42 +9,68 @@ ChevronRight, Icon, } from 'svelte-hero-icons' + import { backOut } from 'svelte/easing' + import { fly } from 'svelte/transition' export let page: number = 0 export let cursor: { next?: string; back?: string } | undefined = undefined + export let hasMore: boolean = true const dispatcher = createEventDispatcher<{ change: number; cursor: string }>() -
+
+ diff --git a/src/lib/components/ui/layout/Shell.svelte b/src/lib/components/ui/layout/Shell.svelte index 3a3a510f..fcf34009 100644 --- a/src/lib/components/ui/layout/Shell.svelte +++ b/src/lib/components/ui/layout/Shell.svelte @@ -38,21 +38,27 @@ content: boolean ): { top: number + bottom: number class: string } => { if (panel) { if (top) { - if (content) return { top: 80, class: '!pt-20' } - else return { top: 64, class: 'top-16 !max-h-[calc(100vh-4rem)]' } - } else return { top: 0, class: '!pb-20' } + if (content) return { top: 80, class: '!pt-20', bottom: 0 } + else + return { + top: 64, + class: 'top-16 !max-h-[calc(100vh-4rem)]', + bottom: 0, + } + } else return { top: 0, class: '!pb-20', bottom: 80 } } else { - if (!content) return { top: 0, class: '' } + if (!content) return { top: 0, class: '', bottom: 0 } - if (top) return { top: 96, class: '!pt-24' } - else return { top: 0, class: '!pb-24' } + if (top) return { top: 96, class: '!pt-24', bottom: 0 } + else return { top: 0, class: '!pb-24', bottom: 96 } } - return { top: 0, class: ' failed-to-calculate' } + return { top: 0, class: ' failed-to-calculate', bottom: 0 } } export let screenWidth = writable(1000) diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index c2def394..ad52ad27 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -833,5 +833,11 @@ "captcha_failed": "Incorrect CAPTCHA answer.", "cant_block_local_instance": "You can't block the instance you are actively using.", "invalid_vote_value": "You can't commit voter fraud on Lemmy posts, sorry." + }, + "aria": { + "pagination": { + "nav": "Pagination", + "current": "Current page" + } } } diff --git a/src/routes/inbox/+page.svelte b/src/routes/inbox/+page.svelte index 5d59d05b..acaf77de 100644 --- a/src/routes/inbox/+page.svelte +++ b/src/routes/inbox/+page.svelte @@ -82,7 +82,7 @@
{/each} -
- searchParam($page.url, 'page', p.detail.toString())} - /> + {/if} + {#if !(data.page == 1 && (data?.data?.length ?? 0) == 0)} +
+ + searchParam($page.url, 'page', p.detail.toString())} + /> +
{/if}