Commit 91cd9e0
authored
feat: add column sorting to DataTable component (#1282)
* feat: add column sorting to DataTable component
- Import getSortedRowModel and SortingState from @tanstack/react-table
- Import ArrowUp, ArrowDown, ArrowUpDown icons from lucide-react
- Add sorting state with optional defaultSort prop
- Wire getSortedRowModel and onSortingChange into useReactTable config
- Export SortableHeader component for use in column definitions
* fix: add aria-sort and aria-label to SortableHeader for accessibility
Screen reader users can now identify sort state and available actions
via proper ARIA attributes on the sortable column header button.
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 1bcc534 commit 91cd9e0
1 file changed
Lines changed: 43 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
55 | 93 | | |
56 | 94 | | |
57 | 95 | | |
| |||
184 | 222 | | |
185 | 223 | | |
186 | 224 | | |
| 225 | + | |
187 | 226 | | |
188 | 227 | | |
189 | 228 | | |
190 | 229 | | |
| 230 | + | |
191 | 231 | | |
192 | 232 | | |
193 | 233 | | |
| |||
198 | 238 | | |
199 | 239 | | |
200 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
201 | 244 | | |
202 | 245 | | |
203 | 246 | | |
| |||
0 commit comments