Implement Pagination component and App state management#1495
Implement Pagination component and App state management#1495sonik-boom71 wants to merge 1 commit into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation successfully meets all functional requirements for the pagination feature. The Pagination component is correctly implemented as a stateless component with proper TypeScript types, and the App component properly manages state with all required data-cy attributes intact. The only noted issue is that the active class is applied to the anchor element rather than the parent li element per Bootstrap conventions. However, since the review indicates tests pass and all core requirements are satisfied, this styling convention difference does not prevent task completion.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| <li | ||
| key={page} | ||
| className={`page-item${page === currentPage ? ' active' : ''}`} |
There was a problem hiding this comment.
The active class is applied to the a element (page-link) instead of the li element (page-item). Per Bootstrap pagination conventions, the active class should be on the parent li element. While tests may pass if they only check for .active presence, the requirement specifies li.active which typically means the class should be on the li.
Created stateless Pagination component with props: total, perPage, currentPage (default: 1), onPageChange
Renders page links with data-cy="pageLink", highlights active page with li.active
« / » prev/next links: disabled on first/last page via li.disabled and aria-disabled="true"
onPageChange triggers only when the page actually changes
App saves current page state and listens to onPageChange
Pagination info shows in format: Page 1 (items 1 - 5 of 42)
with options 3, 5, 10, 20 — resets to page 1 on change Items list renders only items for the current page DEMO LINK https://sonik-boom71.github.io/react_pagination/