Skip to content

Commit

Permalink
feat: restore original pagination order
Browse files Browse the repository at this point in the history
  • Loading branch information
CoodingPenguin committed Jan 11, 2025
1 parent 25143a8 commit dffc9cb
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/components/Pagination.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ function getVisiblePages(total: number, current: number): Array<number | null> {
result.push(page);
previousPage = page;
}
// reverse order
return result.reverse();
return result;
}
---

Expand All @@ -69,12 +68,12 @@ function getVisiblePages(total: number, current: number): Array<number | null> {
>
<div class="-mt-px flex w-0 flex-1">
{
current < total ? (
current > 1 ? (
<a
href={
tag
? BASE + "/tags/" + tag + "/" + (current + 1)
: BASE + "/pages/" + (current + 1)
? BASE + "/tags/" + tag + "/" + (current - 1)
: BASE + "/pages/" + (current - 1)
}
class="inline-flex items-center border-t-2 border-transparent pr-1 pt-4 text-sm font-medium text-base-500 hover:border-base-300 hover:text-base-700 dark:text-base-400 dark:hover:border-base-700 dark:hover:text-base-300"
>
Expand All @@ -91,7 +90,7 @@ function getVisiblePages(total: number, current: number): Array<number | null> {
clip-rule="evenodd"
/>
</svg>
older
newer
</a>
) : null
}
Expand All @@ -117,16 +116,16 @@ function getVisiblePages(total: number, current: number): Array<number | null> {

<div class="-mt-px flex w-0 flex-1 justify-end">
{
current > 1 ? (
current < total ? (
<a
href={
tag
? BASE + "/tags/" + tag + "/" + (current - 1)
: BASE + "/pages/" + (current - 1)
? BASE + "/tags/" + tag + "/" + (current + 1)
: BASE + "/pages/" + (current + 1)
}
class="inline-flex items-center border-t-2 border-transparent pr-1 pt-4 text-sm font-medium text-base-500 hover:border-base-300 hover:text-base-700 dark:text-base-400 dark:hover:border-base-700 dark:hover:text-base-300"
>
newer
older
<svg
class="ml-3 h-5 w-5 text-base-400"
viewBox="0 0 20 20"
Expand Down

0 comments on commit dffc9cb

Please sign in to comment.