feat: redo pagination
This commit is contained in:
1 parent
25c440516a
commit
a53d3d9955
6 files changed
+77
-6
No files matched your search
+16
-1
@@ -76,7 +76,22 @@
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
>
|
||||
<span class="max-sm:hidden">
|
||||
You've viewed <span
|
||||
class="text-primary-900 dark:text-primary-100 font-bold"
|
||||
>
|
||||
{data.page * 20}
|
||||
</span>
|
||||
posts.
|
||||
</span>
|
||||
<span class="sm:hidden">
|
||||
<span class="text-primary-900 dark:text-primary-100">
|
||||
{data.page * 20}
|
||||
</span>
|
||||
posts
|
||||
</span>
|
||||
</Pageination>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden xl:block">
|
||||
|
||||
@@ -70,10 +70,26 @@
|
||||
</div>
|
||||
</div>
|
||||
<PostFeed posts={data.posts.posts} />
|
||||
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
>
|
||||
{#if data.posts.posts.length > 0}
|
||||
<span class="max-sm:hidden">
|
||||
You've scrolled <span class="text-primary-900 dark:text-primary-100">
|
||||
{data.page * 20}
|
||||
</span>
|
||||
posts.
|
||||
</span>
|
||||
<span class="sm:hidden">
|
||||
<span class="text-primary-900 dark:text-primary-100">
|
||||
{data.page * 20}
|
||||
</span>
|
||||
posts
|
||||
</span>
|
||||
{/if}
|
||||
</Pageination>
|
||||
</div>
|
||||
<div class="hidden xl:block">
|
||||
<CommunityCard
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowPath,
|
||||
ChevronDoubleUp,
|
||||
ExclamationTriangle,
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
@@ -27,6 +28,7 @@
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -295,6 +297,20 @@
|
||||
</div>
|
||||
{:then comments}
|
||||
<Comments post={post.post_view.post} nodes={comments} isParent={true} />
|
||||
{#if comments.length > 5}
|
||||
<EndPlaceholder>
|
||||
You've viewed {post.post_view.counts.comments} comments.
|
||||
|
||||
<Button
|
||||
color="tertiary"
|
||||
on:click={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
slot="action"
|
||||
>
|
||||
<Icon src={ChevronDoubleUp} mini size="16" slot="prefix" />
|
||||
Scroll to top
|
||||
</Button>
|
||||
</EndPlaceholder>
|
||||
{/if}
|
||||
{/await}
|
||||
{:catch}
|
||||
<div class="bg-red-500/10 border border-red-500 rounded-md p-4">
|
||||
|
||||
Reference in new issue
Block a user