Compare commits
1 Commits
d3361cb8f3
...
e945fc2f79
| Author | SHA1 | Date |
|---|---|---|
|
|
e945fc2f79 |
|
|
@ -13,11 +13,9 @@
|
|||
return qs !== '' ? `?${qs}` : qs;
|
||||
}
|
||||
|
||||
const { query, page } = data;
|
||||
$: hasResults = (data.results || []).length > 0;
|
||||
$: currentPage = data.page + 1;
|
||||
$: pageCount = Math.max(1, Math.ceil(data.found / data.limit));
|
||||
$: console.log(`page: ${currentPage}, count: ${pageCount}, `);
|
||||
</script>
|
||||
|
||||
{#if hasResults}
|
||||
|
|
@ -26,7 +24,9 @@
|
|||
<ol class="flex justify-between w-full center" style="padding: 0 10%;">
|
||||
{#if currentPage > 1}
|
||||
<li in:fade>
|
||||
<a href="/{buildQueryString({ query, page: currentPage - 1 })}"><Previous</a>
|
||||
<a href="/{buildQueryString({ query: data.query, page: currentPage - 1 })}"
|
||||
><Previous</a
|
||||
>
|
||||
</li>
|
||||
{:else}
|
||||
<li />
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
<li>Page {currentPage} of {pageCount}</li>
|
||||
{#if currentPage < pageCount}
|
||||
<li in:fade>
|
||||
<a href="/{buildQueryString({ query, page: currentPage + 1 })}">Next></a>
|
||||
<a href="/{buildQueryString({ query: data.query, page: currentPage + 1 })}">Next></a>
|
||||
</li>
|
||||
{/if}
|
||||
</ol>
|
||||
|
|
|
|||
Loading…
Reference in New Issue