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