Coder Social home page Coder Social logo

react_pagination's Introduction

React Pagination

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.

  1. The Pagination should 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) => { ... }}
    />
  2. Keep the HTML stucture data-cy attributes;
  3. Show all the existing pages considering total and perPage
  4. Current page should be highlighted with li.active;
  5. onPageChange callback should be triggered only if page was changed;
  6. The App should listen to the onPageChange and save a new page;
  7. « 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.disabled and a[aria-disabled="true"])
  8. Show the pagination info inside data-cy="info" in the next format Page 1 (items 1 - 5 of 42);
  9. Implement the <select data-cy="perPageSelector"> with 3, 5, 10, 20 options to change the perPage;
    • show the 1st page after changing a perPage;
  10. (*) Use React Router to save ?page=2&perPage=7 in the URL and apply them on page load

Instructions

  • 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 test to ensure your solution is correct.
  • Replace <your_account> with your Github username in the DEMO LINK and add it to the PR description.

react_pagination's People

Contributors

danheim avatar ibrianwarner avatar mgrinko avatar mykhalenych avatar oablokhina avatar vpolets avatar yuriiholiuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.