mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
fix: hide pagination when there's only 1 page
This commit is contained in:
+29
-29
@@ -36,35 +36,35 @@ const next = pageNum < totalPages ? "" : "disabled";
|
|||||||
</ul>
|
</ul>
|
||||||
</Main>
|
</Main>
|
||||||
|
|
||||||
<nav class="pagination-wrapper" aria-label="Pagination">
|
{
|
||||||
<LinkButton
|
totalPages > 1 && (
|
||||||
disabled={prev === "disabled"}
|
<nav class="pagination-wrapper" aria-label="Pagination">
|
||||||
href={`/posts${pageNum - 1 !== 1 ? "/" + (pageNum - 1) : ""}`}
|
<LinkButton
|
||||||
className={`mr-4 select-none ${prev}`}
|
disabled={prev === "disabled"}
|
||||||
ariaLabel="Previous"
|
href={`/posts${pageNum - 1 !== 1 ? "/" + (pageNum - 1) : ""}`}
|
||||||
>
|
className={`mr-4 select-none ${prev}`}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class={`${prev}-svg`}>
|
ariaLabel="Previous"
|
||||||
<path
|
>
|
||||||
d="M12.707 17.293 8.414 13H18v-2H8.414l4.293-4.293-1.414-1.414L4.586 12l6.707 6.707z"
|
<svg xmlns="http://www.w3.org/2000/svg" class={`${prev}-svg`}>
|
||||||
></path>
|
<path d="M12.707 17.293 8.414 13H18v-2H8.414l4.293-4.293-1.414-1.414L4.586 12l6.707 6.707z" />
|
||||||
</svg>
|
</svg>
|
||||||
Prev
|
Prev
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
<LinkButton
|
<LinkButton
|
||||||
disabled={next === "disabled"}
|
disabled={next === "disabled"}
|
||||||
href={`/posts/${pageNum + 1}`}
|
href={`/posts/${pageNum + 1}`}
|
||||||
className={`ml-4 select-none ${next}`}
|
className={`ml-4 select-none ${next}`}
|
||||||
ariaLabel="Next"
|
ariaLabel="Next"
|
||||||
>
|
>
|
||||||
Next
|
Next
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class={`${next}-svg`}>
|
<svg xmlns="http://www.w3.org/2000/svg" class={`${next}-svg`}>
|
||||||
<path
|
<path d="m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" />
|
||||||
d="m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z"
|
</svg>
|
||||||
></path>
|
</LinkButton>
|
||||||
</svg>
|
</nav>
|
||||||
</LinkButton>
|
)
|
||||||
</nav>
|
}
|
||||||
<Footer noMarginTop />
|
<Footer noMarginTop={totalPages > 1} />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user