Skip to content

Commit

Permalink
fix(ui): pagination bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BQXBQX committed Feb 25, 2024
1 parent 0681442 commit ec7b349
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/ui/lib/Pagination/Pagination.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
@use '../variables' as *;
.base {
display: flex;
flex-direction: row;
gap: 5px;
&.disabled {
@include disabled;
}
.pagination-item {
width: 32px;
height: 32px;
Expand Down
16 changes: 12 additions & 4 deletions packages/ui/lib/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
type="select"
key={i}
index={i}
disabled={disabled}
>
{i + 1}
</PaginationItem>,
Expand All @@ -94,6 +95,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
<PaginationItem
type="select"
index={i}
disabled={disabled}
>
{i + 1}
</PaginationItem>,
Expand All @@ -109,6 +111,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
<PaginationItem
type="select"
index={i}
disabled={disabled}
>
{i + 1}
</PaginationItem>,
Expand All @@ -122,6 +125,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
<PaginationItem
type="select"
index={i}
disabled={disabled}
>
{i + 1}
</PaginationItem>,
Expand All @@ -137,6 +141,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
<PaginationItem
type="select"
index={i}
disabled={disabled}
>
{i + 1}
</PaginationItem>,
Expand All @@ -148,7 +153,8 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
newItems.push(
<PaginationItem
type="select"
index={1}
index={0}
disabled={disabled}
>
{1}
</PaginationItem>,
Expand All @@ -163,6 +169,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
<PaginationItem
type="select"
index={i}
disabled={disabled}
>
{i + 1}
</PaginationItem>,
Expand All @@ -176,7 +183,8 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
newItems.push(
<PaginationItem
type="select"
index={pageNumber}
index={pageNumber - 1}
disabled={disabled}
>
{pageNumber}
</PaginationItem>,
Expand All @@ -197,7 +205,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
>
<PaginationItem
type="delete"
disabled={currentPage === 1}
disabled={currentPage === 1 || disabled}
>
<svg
width="16"
Expand All @@ -212,7 +220,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
{itemList}
<PaginationItem
type="add"
disabled={currentPage === pageNumber}
disabled={currentPage === pageNumber || disabled}
>
<svg
width="16"
Expand Down

0 comments on commit ec7b349

Please sign in to comment.