The challenge
Dashboards tend to rot into one giant component where data rules, layout and styling are tangled together. They also tend to be inaccessible: sortable tables with no announced state, charts that are only pictures.
The goal was a small codebase where the business rules are testable without a browser and the interface is usable with a keyboard and a screen reader.
How I approached it
- 01
Logic separated from the UI
Filtering, sorting, weekly bucketing and the KPI maths live in a pure
stats.tsmodule with its own tests. Components only render what those functions return, and memoized derived state keeps typing in the search box cheap. - 02
A chart with no chart library
The weekly revenue chart is a small responsive SVG component with per-bar tooltips and a visually hidden text alternative, so it costs a few hundred bytes instead of a charting dependency and is still readable by assistive tech.
- 03
Accessibility as a feature, not a pass at the end
Labelled form controls,
aria-sorton sortable headers, a live-region result count, visible focus styles, semantic table, definition-list KPIs and colour-plus-text status badges. - 04
Responsive by default
A mobile-first Tailwind layout: stat cards reflow from four columns to two, the table scrolls inside its own container instead of breaking the page, and filters wrap.
- 05
Dark mode that respects the user
The theme follows the system preference on first load and can be toggled, using Tailwind's class-based dark variant.
- 06
Tested at two levels
Vitest covers the data logic (filters, sort immutability, revenue rules, empty input) and Testing Library drives the real component: search, empty state, sort toggling and pagination.
Deliberate trade-offs
- Data is generated in the browser. It is a demo, not a connected product, which keeps it dependency-free and easy to run. The pure data layer is the part that would be swapped for an API client.
- Pagination and filtering are client-side, which is right for hundreds of rows. For large datasets the same function signatures would move to server-side queries.
What I built
- Designed the component structure, types and state flow for filters, sorting and pagination.
- Wrote a seeded mock-data generator so the demo and tests are deterministic.
- Built the SVG bar chart, stat cards, sortable table and pagination from scratch.
- Added light and dark themes and a responsive layout from phone to desktop.
- Wrote 10 tests and documented setup and scripts in the README.
What this project demonstrates
- Strict-typed React with a clean logic and UI split
- Accessible, responsive, theme-aware interfaces
- Component and unit testing, not just visual polish
- Pairs with my Laravel APIs for true full-stack delivery