feat(ui): add DataTable design-system component - #1108
Conversation
Closes FinesseStudioLab#971 - Added DataTable component to src/components/ui/ with sortable columns, pagination (delegates to existing Pagination component), and three special states: loading (shimmer skeleton rows), empty, and error - Sorting: aria-sort on <th scope="col">, real <button> controls for keyboard reach, polite live region announces each sort change to screen readers - Accessibility: table with role="grid", aria-busy on tbody while loading, error state uses role="alert" on the spanning cell - Styles scoped to .ds-table-* BEM classes consuming --ds-* tokens from tokens.css; light-theme override and prefers-reduced-motion guard included - Added DataTable.test.jsx (18 unit tests, all passing): covers nextSort helper, column render, custom cell render, empty/loading/error states, sort interaction, pagination delegation, and ARIA attributes - Added DataTable.stories.jsx with 7 Storybook stories: Default, Sortable, WithPagination (interactive), Loading, Empty, Error, CustomCellRender, and LightTheme - Exported DataTable and nextSort from the design-system barrel (index.js)
|
hey @joelpeace48-cell, here's my implementation for issue #971 — added the DataTable component to the design system with sorting, pagination, empty/loading/error states, 18 unit tests, and 7 Storybook stories. happy to adjust anything! |
|
@thebabalola Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
hey @joelpeace48-cell, fixed the lint errors in the DataTable stories — the WithPagination story had a lowercase render function calling useState, which tripped the react-hooks rule. renamed it to Render and the frontend lint/build/test suite all passes locally now. let me know if anything else looks off! |
Closes #971
Summary
Adds a shared, accessible
DataTablecomponent to the design system undersrc/components/ui/, filling the gap where each page (leaderboards, transaction history, admin lists) was building ad-hoc table UI.What changed
frontend/src/components/ui/DataTable.jsx<th scope="col">witharia-sort, real<button>controls so sort is fully keyboard-reachable<Pagination />design-system component (no duplication)aria-busyon<tbody>), empty (configurable message), error (role="alert"on the spanning cell)aria-liveregion announces the active sort to screen readers after each changerender(value, row)functionrole="grid"for correct screen-reader announcementfrontend/src/components/ui/DataTable.css.ds-table-*BEM classes, entirely themed through--ds-*tokens fromtokens.cssprefers-reduced-motionguard:root[data-theme='light']frontend/src/components/ui/DataTable.test.jsxnextSorthelper, column rendering, custom cell render, empty / loading / error states, sort click interactions, pagination delegation, and ARIA attribute checksfrontend/src/stories/DataTable.stories.jsxfrontend/src/components/ui/index.jsDataTableandnextSortfrom the design-system barrelLocal CI verification
npx vitest run src/components/ui/DataTable.test.jsx→ 18/18 tests passed ✅npm run format:check→ all new/modified files pass prettier ✅SECURITY.md,.github/FUNDING.yml) are pre-existing inupstream/mainand unrelated to this PR