design: make pageination more consistent with other floats

This commit is contained in:
James Xylight committed 2025-09-05 16:42:09 -07:00
1 parent 57d2bf5e72
commit 63eafdd1e1
6 files changed
+70 -59

No files matched your search

@@ -314,10 +314,11 @@
<div class="flex flex-col gap-1">
<span class="font-medium text-sm">{$t('form.post.community')}</span>
<Button
class="w-full bg-white! dark:bg-black! h-[38px]"
class="w-full"
onclick={() => (data.community = null)}
alignment="left"
size="sm"
rounding="xl"
>
{#snippet prefix()}
<Avatar
@@ -327,7 +328,7 @@
/>
{/snippet}
<div class="flex flex-col gap-0">
<span class="text-xs">{data.community.name}</span>
<span class="text-sm">{data.community.name}</span>
<span class="text-[10px] leading-3">
{new URL(data.community.actor_id).hostname}
</span>
+55 -49
View File
@@ -42,61 +42,67 @@
}
</script>
<nav
aria-label={$t('aria.pagination.nav')}
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">
{@render children?.()}
</span>
<hr class="border-slate-200 dark:border-zinc-800 flex-1" />
{/if}
{#if back}
{#if hasMore || page != 1}
<nav
aria-label={$t('aria.pagination.nav')}
class={[
'flex flex-row gap-2 items-center justify-center bg-white dark:bg-zinc-900',
'border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden w-max mx-auto p-0.5',
'shadow-md',
]}
>
{#if children}
<span class="text-sm text-slate-600 dark:text-zinc-400 font-medium">
{@render children?.()}
</span>
<hr class="border-slate-200 dark:border-zinc-800 flex-1" />
{/if}
{#if back}
<Button
href={customHref(href?.(cursor?.back ?? page - 1))}
color="tertiary"
onclick={() => invalidate(pageData.url)}
title={$t('common.back')}
rounding="pill"
size="custom"
class="text-inherit dark:text-inherit p-1"
disabled={(cursor?.back == undefined && cursor?.next != undefined) ||
page <= 1}
>
{#snippet suffix()}
<Icon src={ChevronLeft} size="24" mini />
{/snippet}
</Button>
{/if}
{#if page}
<div style="display: grid;">
{#key page}
<div
in:fly={{ y: 8, easing: backOut, duration: 400, delay: 100 }}
out:fly={{ y: 8, easing: backOut, duration: 400 }}
class="text-lg font-medium"
style="grid-column: 1; grid-row: 1;"
>
{page}
</div>
{/key}
</div>
{/if}
<Button
href={customHref(href?.(cursor?.back ?? page - 1))}
href={customHref(href?.(cursor?.next ?? page + 1))}
color="tertiary"
onclick={() => invalidate(pageData.url)}
title={$t('common.back')}
rounding="pill"
title={$t('common.next')}
size="custom"
rounding="pill"
class="text-inherit dark:text-inherit p-1"
disabled={(cursor?.back == undefined && cursor?.next != undefined) ||
page <= 1}
disabled={!hasMore}
>
{#snippet suffix()}
<Icon src={ChevronLeft} size="24" mini />
<Icon src={ChevronRight} size="24" mini />
{/snippet}
</Button>
{/if}
{#if page}
<div style="display: grid;">
{#key page}
<div
in:fly={{ y: 8, easing: backOut, duration: 400, delay: 100 }}
out:fly={{ y: 8, easing: backOut, duration: 400 }}
class="text-lg font-medium"
style="grid-column: 1; grid-row: 1;"
>
{page}
</div>
{/key}
</div>
{/if}
<Button
href={customHref(href?.(cursor?.next ?? page + 1))}
color="tertiary"
onclick={() => invalidate(pageData.url)}
title={$t('common.next')}
size="custom"
rounding="pill"
class="text-inherit dark:text-inherit p-1"
disabled={!hasMore}
>
{#snippet suffix()}
<Icon src={ChevronRight} size="24" mini />
{/snippet}
</Button>
</nav>
</nav>
{/if}
@@ -13,6 +13,7 @@
buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string
children?: import('svelte').Snippet
style?: 'header' | 'subpage'
margin?: boolean
}
let {
@@ -21,6 +22,7 @@
buildUrl = (_, href) => href,
children,
style = 'header',
margin = true,
}: Props = $props()
let matchType = $derived<('search' | 'pathname')[]>(
@@ -53,10 +55,12 @@
<nav
class={[
'flex flex-row items-center my-2 sm:mt-0 flex-wrap z-20',
'flex flex-row items-center sm:mt-0 flex-wrap z-20',
style == 'header'
? 'p-1 gap-x-8 gap-y-4 justify-center sm:justify-start'
: 'gap-2',
margin && 'my-2',
margin && style == 'subpage' && 'mb-3',
]}
>
{#each routes as route, index (route.href)}
@@ -86,7 +90,3 @@
{/each}
{@render children?.()}
</nav>
{#if style == 'subpage'}
<div class="h-3"></div>
{/if}