design: make pageination more consistent with other floats
This commit is contained in:
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>
|
||||
|
||||
@@ -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}
|
||||
@@ -17,6 +17,7 @@
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import SearchBar from '../search/SearchBar.svelte'
|
||||
import Fixate from '$lib/components/ui/generic/Fixate.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -157,10 +158,10 @@
|
||||
</ul>
|
||||
{/if}
|
||||
{#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
|
||||
page={Number(page.url.searchParams.get('page')) || 1}
|
||||
href={c => `?page=${c}`}
|
||||
/>
|
||||
</div>
|
||||
</Fixate>
|
||||
{/if}
|
||||
@@ -35,9 +35,11 @@
|
||||
<Header pageHeader>
|
||||
{routes.find(r => page.url.pathname == r.href)?.name ??
|
||||
$t('routes.profile.credentials')}
|
||||
{#snippet extended()}
|
||||
<Tabs style="subpage" margin={false} {routes}></Tabs>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<Tabs style="subpage" {routes}></Tabs>
|
||||
<div
|
||||
class={[
|
||||
page.url.pathname == '/profile/password' && ' p-8',
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
icon={Bookmark}
|
||||
title="No saved items"
|
||||
description="Save posts or comments, and they'll be here to refer to them later."
|
||||
class="my-auto"
|
||||
/>
|
||||
{:else}
|
||||
<CommonList items={data.data} size="lg">
|
||||
|
||||
Reference in new issue
Block a user