Pagination is broken if there is only one page
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start by reproducing the issue with the shown Pagination props, then inspect the Pagination component and its range function. Verify the single-page case and confirm that page 1 appears between the previous and next buttons without changing the multi-page behavior.
Written by the indexing model from the issue text.
Description
- I have searched the Issues to see if this bug has already been reported
- I have tested the latest version
Steps to reproduce
- Render pagination component with this props:
<Pagination
currentPage={1}
totalPages={1}
showIcons
nextLabel=""
previousLabel=""
/>
Current behavior
There is no 1 between the arrows, just two buttons (previous and next)
Expected behavior
1 is shown between the arrows, similarly to the case when we have 2 and more pages.
Context
I would like to show the Pagination component with only one page when user has a small amount of data.
The problem is in range function, where this check is contained
if (start >= end) {
return [];
}
I would assume it should be
if (start > end) {
return [];
}
but not sure whether this breaks the expected behaviour from your side. If you are fine I can create the PR.
Thanks,
Sergii
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 506
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from themesberg/flowbite-react
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
themesberg/flowbite-react#1469 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
themesberg/flowbite-react#1686 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
themesberg/flowbite-react#1677 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
themesberg/flowbite-react#1672 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
themesberg/flowbite-react#1658 · 1 comment · 3 reactions ·
All issues in themesberg/flowbite-react
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100