Skip to content

Instantly share code, notes, and snippets.

@trevorlinton
Created May 15, 2020 20:16
Show Gist options
  • Save trevorlinton/06e64fe9eccd73835dc31006b12ad772 to your computer and use it in GitHub Desktop.
Save trevorlinton/06e64fe9eccd73835dc31006b12ad772 to your computer and use it in GitHub Desktop.
Great programming challenges

Build a pagination (e.g., 1,2,4,...)

  1. For any amount of items
  2. Variable amount of items on each page
  3. Show at maximum 11 items in the pagination. (Use ... to summarize missing items).
  4. Must have a previous button that always shows (that's disabled if nothing is previous)
  5. Always show the next button that always shows (that's disabled if nothing is next)
  6. Always show the first and second page (if they're available)
  7. Always show the last page and second to last page (if they're available)
  8. Always show the page before the current page (if its available)
  9. Always show hte page after the current page (if its available) and only showing at max 11 items in the pagination. You can use ... to summize items are missing,
  10. Always attempt to show the LEAST amount of buttons in the pagination possible without violating the previous rules.
  11. If the user is at the end of the pagination show the last 7 items
  12. If the user is at the beginning of the pagination show the first 7 items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment