misc: add a scroll to top button

This commit is contained in:
Xylight committed 2024-08-02 13:33:02 -07:00
1 parent f56167099d
commit 4f52f2cc11
2 files changed
+11 -5

No files matched your search

@@ -11,6 +11,7 @@
import { Badge, Button } from 'mono-svelte'
import {
ArchiveBox,
ChevronDoubleUp,
ExclamationTriangle,
Icon,
Minus,
@@ -36,7 +37,7 @@
import { t } from '$lib/translations'
import InfiniteScroll from 'svelte-infinite-scroll'
import type { Readable } from 'svelte/motion'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte';
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
export let posts: PostView[]
export let community: boolean = false
@@ -223,7 +224,7 @@
bind:this={virtualItemEls[index]}
data-index={row.index}
class="relative post-container"
in:fly={{ y: -16, easing: expoOut, duration: 500, opacity: 0 }}
in:fly={{ y: -16, easing: expoOut, duration: 500, opacity: 0 }}
>
{#if posts[row.index]}
<Post
@@ -282,6 +283,10 @@
// @ts-ignore
community_name: feedData.community_name ?? 'undefined',
})}
<Button slot="action" color="tertiary">
<Icon src={ChevronDoubleUp} size="16" micro slot="prefix" />
{$t('routes.post.scrollToTop')}
</Button>
</EndPlaceholder>
</div>
{/if}
+4 -3
View File
@@ -1,9 +1,10 @@
<div
class="flex flex-row items-center text-sm text-slate-600 dark:text-zinc-400 gap-2"
class="flex flex-col sm:flex-row items-center
text-sm text-slate-600 dark:text-zinc-400 gap-2"
>
<span class="font-medium">
<span class="font-medium text-center sm:text-left">
<slot />
</span>
<hr class="border-slate-200 flex-1 dark:border-zinc-800" />
<hr class="border-slate-200 sm:flex-1 w-full dark:border-zinc-800" />
<slot name="action" />
</div>