Data Table
Build a users table with pagination and sorting over the data in the starter.
Requirements
- Show one page of rows with Previous and Next buttons, disabled at the ends, and a "Page x of y" label.
- A page-size selector (5, 10, 20) that returns to the first page when changed.
- Clicking a column header sorts by that column: ascending, then descending on the second click, then back to the original order. Numbers sort numerically, text alphabetically.
- Sorting resets to the first page, and the current sort is indicated on the header.
- Never mutate the data array.
Hints
Hint 1
Derive sorted from the sort state (copy before sorting), then rows from the page and page size; nothing else needs to be stored.
Hint 2
Clamp the page to the last page when the page size grows, so a change never leaves an empty table.
Hint 3
aria-sort on the header announces the direction to assistive tech.