Description:
We need to develop a reusable Paginator Component that can be used across various pages in the application which require pagination support (e.g., Bootcamps list, Users list, Reviews list, etc.). The paginator should be highly customizable and support different use cases throughout the app.
Tasks:
-
Create the Paginator Component:
- The component should accept props such as:
currentPage: the current active page number.
totalPages: the total number of pages available.
onPageChange: a callback to handle page changes.
pageSize: (optional) the number of items per page (default to 10).
showFirstLastButtons: (optional) boolean to show/hide first and last buttons.
-
Styling:
- Ensure the paginator is responsive for mobile and desktop views.
- Apply consistent styling using the existing UI framework (e.g., Bootstrap, React-Bootstrap).
-
Functionality:
- Ensure the paginator supports basic functionality:
- Go to the next page.
- Go to the previous page.
- Jump to the first and last page (if applicable).
- Handle edge cases such as:
- When there's only one page.
- When
currentPage is 1 (disable previous).
- When
currentPage equals totalPages (disable next).
-
Testing:
- Add unit tests to ensure the paginator behaves correctly in various scenarios.
- Write tests for edge cases (e.g., only one page, invalid page number input).
- Ensure that the component works seamlessly with the app's state management and API requests.
Acceptance Criteria:
Description:
We need to develop a reusable Paginator Component that can be used across various pages in the application which require pagination support (e.g., Bootcamps list, Users list, Reviews list, etc.). The paginator should be highly customizable and support different use cases throughout the app.
Tasks:
Create the Paginator Component:
currentPage: the current active page number.totalPages: the total number of pages available.onPageChange: a callback to handle page changes.pageSize: (optional) the number of items per page (default to 10).showFirstLastButtons: (optional) boolean to show/hide first and last buttons.Styling:
Functionality:
currentPageis 1 (disable previous).currentPageequalstotalPages(disable next).Testing:
Acceptance Criteria: