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
+32 -30

No files matched your search

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