Skip to content

Commit

Permalink
stub pagination more
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Apr 29, 2024
1 parent ba01ecf commit f5dc0f7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/routes/documents/[id]-[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,19 @@
goto(u);
}
// pagination
function next() {
currentPage = Math.min(currentPage + 1, document.page_count);
}
function previous() {
currentPage = Math.max(currentPage - 1, 1);
}
// scroll to a page
function scrollToPage(n: number) {}
function scrollToPage(n: number) {
currentPage = n;
}
</script>

<ContentLayout>
Expand Down Expand Up @@ -65,10 +76,14 @@

<Paginator
slot="center"
on:goTo={console.log}
goToNav
page={currentPage}
on:goTo={(e) => scrollToPage(e.detail)}
on:next={next}
on:previous={previous}
bind:page={currentPage}
totalPages={document.page_count}
has_next={currentPage < document.page_count}
has_previous={currentPage > 1}
/>
</PageToolbar>
</ContentLayout>
Expand Down

0 comments on commit f5dc0f7

Please sign in to comment.