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"> <div class="flex flex-col gap-1">
<span class="font-medium text-sm">{$t('form.post.community')}</span> <span class="font-medium text-sm">{$t('form.post.community')}</span>
<Button <Button
class="w-full bg-white! dark:bg-black! h-[38px]" class="w-full"
onclick={() => (data.community = null)} onclick={() => (data.community = null)}
alignment="left" alignment="left"
size="sm" size="sm"
rounding="xl"
> >
{#snippet prefix()} {#snippet prefix()}
<Avatar <Avatar
@@ -327,7 +328,7 @@
/> />
{/snippet} {/snippet}
<div class="flex flex-col gap-0"> <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"> <span class="text-[10px] leading-3">
{new URL(data.community.actor_id).hostname} {new URL(data.community.actor_id).hostname}
</span> </span>
+55 -49
View File
@@ -42,61 +42,67 @@
} }
</script> </script>
<nav {#if hasMore || page != 1}
aria-label={$t('aria.pagination.nav')} <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" aria-label={$t('aria.pagination.nav')}
> class={[
{#if children} 'flex flex-row gap-2 items-center justify-center bg-white dark:bg-zinc-900',
<span class="text-sm text-slate-600 dark:text-zinc-400 font-medium"> 'border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden w-max mx-auto p-0.5',
{@render children?.()} 'shadow-md',
</span> ]}
<hr class="border-slate-200 dark:border-zinc-800 flex-1" /> >
{/if} {#if children}
{#if back} <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 <Button
href={customHref(href?.(cursor?.back ?? page - 1))} href={customHref(href?.(cursor?.next ?? page + 1))}
color="tertiary" color="tertiary"
onclick={() => invalidate(pageData.url)} onclick={() => invalidate(pageData.url)}
title={$t('common.back')} title={$t('common.next')}
rounding="pill"
size="custom" size="custom"
rounding="pill"
class="text-inherit dark:text-inherit p-1" class="text-inherit dark:text-inherit p-1"
disabled={(cursor?.back == undefined && cursor?.next != undefined) || disabled={!hasMore}
page <= 1}
> >
{#snippet suffix()} {#snippet suffix()}
<Icon src={ChevronLeft} size="24" mini /> <Icon src={ChevronRight} size="24" mini />
{/snippet} {/snippet}
</Button> </Button>
{/if} </nav>
{/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>
@@ -13,6 +13,7 @@
buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string
children?: import('svelte').Snippet children?: import('svelte').Snippet
style?: 'header' | 'subpage' style?: 'header' | 'subpage'
margin?: boolean
} }
let { let {
@@ -21,6 +22,7 @@
buildUrl = (_, href) => href, buildUrl = (_, href) => href,
children, children,
style = 'header', style = 'header',
margin = true,
}: Props = $props() }: Props = $props()
let matchType = $derived<('search' | 'pathname')[]>( let matchType = $derived<('search' | 'pathname')[]>(
@@ -53,10 +55,12 @@
<nav <nav
class={[ 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' style == 'header'
? 'p-1 gap-x-8 gap-y-4 justify-center sm:justify-start' ? 'p-1 gap-x-8 gap-y-4 justify-center sm:justify-start'
: 'gap-2', : 'gap-2',
margin && 'my-2',
margin && style == 'subpage' && 'mb-3',
]} ]}
> >
{#each routes as route, index (route.href)} {#each routes as route, index (route.href)}
@@ -86,7 +90,3 @@
{/each} {/each}
{@render children?.()} {@render children?.()}
</nav> </nav>
{#if style == 'subpage'}
<div class="h-3"></div>
{/if}
+3 -2
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 Fixate from '$lib/components/ui/generic/Fixate.svelte'
let { data } = $props() let { data } = $props()
@@ -157,10 +158,10 @@
</ul> </ul>
{/if} {/if}
{#if data.communities.value.length > 0} {#if data.communities.value.length > 0}
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6"> <Fixate placement="bottom">
<Pageination <Pageination
page={Number(page.url.searchParams.get('page')) || 1} page={Number(page.url.searchParams.get('page')) || 1}
href={c => `?page=${c}`} href={c => `?page=${c}`}
/> />
</div> </Fixate>
{/if} {/if}
@@ -35,9 +35,11 @@
<Header pageHeader> <Header pageHeader>
{routes.find(r => page.url.pathname == r.href)?.name ?? {routes.find(r => page.url.pathname == r.href)?.name ??
$t('routes.profile.credentials')} $t('routes.profile.credentials')}
{#snippet extended()}
<Tabs style="subpage" margin={false} {routes}></Tabs>
{/snippet}
</Header> </Header>
<Tabs style="subpage" {routes}></Tabs>
<div <div
class={[ class={[
page.url.pathname == '/profile/password' && ' p-8', page.url.pathname == '/profile/password' && ' p-8',
+1
View File
@@ -67,6 +67,7 @@
icon={Bookmark} icon={Bookmark}
title="No saved items" title="No saved items"
description="Save posts or comments, and they'll be here to refer to them later." description="Save posts or comments, and they'll be here to refer to them later."
class="my-auto"
/> />
{:else} {:else}
<CommonList items={data.data} size="lg"> <CommonList items={data.data} size="lg">