design: redesign pageination

This commit is contained in:
James Xylight committed 2025-08-24 11:11:07 -07:00
1 parent 85cad1a877
commit 63eeafe8f5
4 files changed
+27 -25

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@
none: '', none: '',
sm: 'mt-3 mb-1 px-3', sm: 'mt-3 mb-1 px-3',
md: 'mt-4 mb-2', md: 'mt-4 mb-2',
lg: 'mt-5 mb-3', lg: 'mt-6 mb-2',
} }
const colors = { const colors = {
@@ -50,7 +50,7 @@
clazz, clazz,
]} ]}
> >
<h3 class="font-medium text-left"> <h3 class="font-medium text-left flex flex-row gap-1 items-center">
{@render children?.()} {@render children?.()}
</h3> </h3>
<div <div
+7 -7
View File
@@ -44,7 +44,7 @@
<nav <nav
aria-label={$t('aria.pagination.nav')} aria-label={$t('aria.pagination.nav')}
class="flex flex-row w-full gap-4 items-center justify-center backdrop-blur-xl border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden" class="flex flex-row gap-2 items-center justify-center backdrop-blur-xl border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden w-max mx-auto p-0.5"
> >
{#if children} {#if children}
<span class="text-sm text-slate-600 dark:text-zinc-400 font-medium"> <span class="text-sm text-slate-600 dark:text-zinc-400 font-medium">
@@ -55,12 +55,12 @@
{#if back} {#if back}
<Button <Button
href={customHref(href?.(cursor?.back ?? page - 1))} href={customHref(href?.(cursor?.back ?? page - 1))}
color="ghost" color="tertiary"
onclick={() => invalidate(pageData.url)} onclick={() => invalidate(pageData.url)}
title={$t('common.back')} title={$t('common.back')}
rounding="none" rounding="pill"
size="custom" size="custom"
class="text-inherit dark:text-inherit border-0 border-r p-2" class="text-inherit dark:text-inherit p-1"
disabled={(cursor?.back == undefined && cursor?.next != undefined) || disabled={(cursor?.back == undefined && cursor?.next != undefined) ||
page <= 1} page <= 1}
> >
@@ -87,12 +87,12 @@
<Button <Button
href={customHref(href?.(cursor?.next ?? page + 1))} href={customHref(href?.(cursor?.next ?? page + 1))}
color="ghost" color="tertiary"
onclick={() => invalidate(pageData.url)} onclick={() => invalidate(pageData.url)}
title={$t('common.next')} title={$t('common.next')}
size="custom" size="custom"
rounding="none" rounding="pill"
class="text-inherit dark:text-inherit border-0 border-l p-2" class="text-inherit dark:text-inherit p-1"
disabled={!hasMore} disabled={!hasMore}
> >
{#snippet suffix()} {#snippet suffix()}
+12 -9
View File
@@ -5,6 +5,7 @@
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte' import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte' import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte' import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
import Pageination from '$lib/components/ui/Pageination.svelte' import Pageination from '$lib/components/ui/Pageination.svelte'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
@@ -65,20 +66,22 @@
this={settings.infiniteScroll && !settings.posts.noVirtualize this={settings.infiniteScroll && !settings.posts.noVirtualize
? 'noscript' ? 'noscript'
: 'div'} : 'div'}
class="mt-auto" class="mt-auto flex flex-col"
> >
<EndPlaceholder>
<Icon src={ChartBar} size="16" mini />
{$t('routes.frontpage.footer', {
users: site.data?.site_view?.counts?.users_active_day ?? '??',
})}
{#snippet action()}
<Pageination <Pageination
cursor={{ next: data.feed.value.cursor.next }} cursor={{ next: data.feed.value.cursor.next }}
href={page => href={page =>
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`} typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
back={false} back={false}
> />
<span class="flex flex-row items-center gap-1"> {/snippet}
<Icon src={ChartBar} size="16" mini /> </EndPlaceholder>
{$t('routes.frontpage.footer', {
users: site.data?.site_view?.counts?.users_active_day ?? '??',
})}
</span>
</Pageination>
</svelte:element> </svelte:element>
</div> </div>
+6 -7
View File
@@ -17,6 +17,7 @@
import { expoOut } from 'svelte/easing' import { expoOut } from 'svelte/easing'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import SearchBar from '../search/SearchBar.svelte' import SearchBar from '../search/SearchBar.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
let { data } = $props() let { data } = $props()
@@ -96,9 +97,7 @@
{/each} {/each}
</div> </div>
{:else} {:else}
<ul <ul class="flex flex-col h-full">
class="flex flex-col divide-y divide-slate-100 dark:divide-zinc-925 my-6 h-full"
>
{#if data.communities.value.length == 0} {#if data.communities.value.length == 0}
<Placeholder <Placeholder
icon={QuestionMarkCircle} icon={QuestionMarkCircle}
@@ -108,9 +107,9 @@
{/if} {/if}
{#if showTop} {#if showTop}
<SectionTitle class="border-0! pb-2"> <EndPlaceholder size="lg" margin="lg">
{$t('routes.search.top')} {$t('routes.search.top')}
</SectionTitle> </EndPlaceholder>
<div <div
class="grid md:grid-cols-2 lg:grid-cols-3 gap-4 items-center mb-6 border-0!" class="grid md:grid-cols-2 lg:grid-cols-3 gap-4 items-center mb-6 border-0!"
> >
@@ -138,9 +137,9 @@
{/if} {/if}
{#if data.communities.value.slice(showTop ? 3 : 0).length > 0} {#if data.communities.value.slice(showTop ? 3 : 0).length > 0}
<SectionTitle class="border-0! pb-2"> <EndPlaceholder size="lg" margin="lg">
{$t('routes.search.other')} {$t('routes.search.other')}
</SectionTitle> </EndPlaceholder>
{/if} {/if}
{#if data.communities.value} {#if data.communities.value}
{@const sliced = data.communities.value.slice(showTop ? 3 : 0)} {@const sliced = data.communities.value.slice(showTop ? 3 : 0)}