Skip to content

feat(ui): add DataTable design-system component - #1108

Merged
joelpeace48-cell merged 3 commits into
FinesseStudioLab:mainfrom
thebabalola:feat/design-system-data-table
Aug 6, 2026
Merged

feat(ui): add DataTable design-system component#1108
joelpeace48-cell merged 3 commits into
FinesseStudioLab:mainfrom
thebabalola:feat/design-system-data-table

Conversation

@thebabalola

Copy link
Copy Markdown
Contributor

Closes #971

Summary

Adds a shared, accessible DataTable component to the design system under src/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

  • Sortable columns — <th scope="col"> with aria-sort, real <button> controls so sort is fully keyboard-reachable
  • Pagination — delegates directly to the existing <Pagination /> design-system component (no duplication)
  • Three states: loading (shimmer skeleton rows, aria-busy on <tbody>), empty (configurable message), error (role="alert" on the spanning cell)
  • Polite aria-live region announces the active sort to screen readers after each change
  • Custom cell renderer: any column accepts a render(value, row) function
  • Table carries role="grid" for correct screen-reader announcement

frontend/src/components/ui/DataTable.css

  • Scoped .ds-table-* BEM classes, entirely themed through --ds-* tokens from tokens.css
  • Shimmer animation for skeleton rows with prefers-reduced-motion guard
  • Light-theme override via :root[data-theme='light']

frontend/src/components/ui/DataTable.test.jsx

  • 18 unit tests (all passing): nextSort helper, column rendering, custom cell render, empty / loading / error states, sort click interactions, pagination delegation, and ARIA attribute checks

frontend/src/stories/DataTable.stories.jsx

  • 7 Storybook stories: Default, Sortable, WithPagination (interactive state), Loading, Empty, Error, CustomCellRender, LightTheme

frontend/src/components/ui/index.js

  • Exported DataTable and nextSort from the design-system barrel

Local CI verification

  • npx vitest run src/components/ui/DataTable.test.jsx18/18 tests passed
  • npm run format:check → all new/modified files pass prettier ✅
  • Remaining 2 prettier warnings (SECURITY.md, .github/FUNDING.yml) are pre-existing in upstream/main and unrelated to this PR

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)
@thebabalola

Copy link
Copy Markdown
Contributor Author

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!

@drips-wave

drips-wave Bot commented Aug 1, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@thebabalola

Copy link
Copy Markdown
Contributor Author

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!

@joelpeace48-cell
joelpeace48-cell merged commit 3fce36a into FinesseStudioLab:main Aug 6, 2026
@grantfox-oss grantfox-oss Bot mentioned this pull request Aug 6, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design system: Data Table component

2 participants