Here is the working version
You a given a list of items and markup for the Pagination. Implement the
Pagination as a stateless component to show only the items for a current page.
- The
Paginationshould be used with the next props:<Pagination total={42} // total number of items to paginate perPage={5} // number of items per page currentPage={1} /* optional with 1 by default */ onPageChange={(page) => { ... }} />
- Keep the HTML stucture
data-cyattributes; - Show all the existing pages considering
totalandperPage - Current page should be highlighted with
li.active; onPageChangecallback should be triggered only if page was changed;- The
Appshould listen to theonPageChangeand save a new page; «and»links should open the prev and the next pages accordingly- disable each of them if it is already the first or the last page (use
li.disabledanda[aria-disabled="true"])
- disable each of them if it is already the first or the last page (use
- Show the pagination info inside
data-cy="info"in the next formatPage 1 (items 1 - 5 of 42); - Implement the
<select data-cy="perPageSelector">with3,5,10,20options to change theperPage;- show the 1st page after changing a
perPage;
- show the 1st page after changing a
- (*) Use React Router to save
?page=2&perPage=7in the URL and apply them on page load
- Install Prettier Extention and use this VSCode settings to enable format on save.
- Implement a solution following the React task guideline.
- Use the React TypeScript cheat sheet.
- Open one more terminal and run tests with
npm testto ensure your solution is correct. - Replace
<your_account>with your Github username in the DEMO LINK and add it to the PR description.