This project is a take-home coding challenge.
Installs the required dependencies
Runs the app in development mode. Open http://localhost:3000 to view it in the browser.
Runs all available tests once and collects a code coverage report
This project is built on top of a base create-react-app. This allowed for quick development of a simple application for demonstrating the abilities of the pivot table. As such much of the boilerplate code comes directly from the create-react-app installation.
public- This directory contains boilerplate public files for the web application. The only modifications made in this directory were to remove unnecessary files, change the application title, and to add a Google fontsrc- This directory contains both boilerplate and the majority of the application code__snapshots__- This directory contains Jest testing snapshots. They are generated automaticallycomponents- The 'meat' of the project__snapshots__- More Jest snapshot filesbody.js- The main body of the table. A composition of everything except the column headersheader.js- The column headers of the tablepivot.js- The top-level pivot table component. Combines the column headers and the bodypivot.test.js- Unit tests for testing the pivot component directlyrow.js- A single row of the body of the table. This does not include any column or row headersrowHeader.js- A single row header component
data- This contains the embedded data files that are used for the project and testing.reducers- This contains reducers that would be used to handle various dispatched actions for the application. In this simple case there is only oneindex.js- The main file containing the reducer. This reducer responds to a dispatched action requesting data and responds with the embedded data. This could be modified to perform an async call to a real API quite easilyreducers.test.js- Unit tests for the reducers
services- Utility services for the application. In this simple case it contains the data parsing utilityparser.js- The data parsing utility. This transforms and aggregates the tabular data into a format that the pivot table can displayparser.test.js- Unit tests for the data parsing utility
styles- This contains the CSS Module files for the project. In a larger project it may make more sense to keep the styling closer to the components that are using the modules, however, in this simple case this seemed more appropriateapp.module.css- The global and top-level styling for the applicationgrid.module.css- The grid specific stylingpivot.module.css- Styling specific to the top-level pivot component and table
App.js- This is the root component of the application. It is what renders the pivot table on the screen and configures itApp.test.js- Unit tests for the application as a whole. Utilizing the react-testing-library this provides a wholistic view of the application as the user would consume itconstants.js- Constant values that are factored out of the main code to make them easier to modify in the future. In this simple implementation this only contains internal data structure field namesindex.js- The root of the application. This is what connects HTML and React togetherserviceWorker.js- create-react-app boilerplate. Not modified or usedsetupTests.js- create-react-app boilerplate. Setup file for Jest. Not modified
- Development tools and dependencies are allowed (i.e. Prettier, TravisCI)
- Multiple dimensions were only supported for rows
- "Dimensions should be configurable in code" - I assumed this to mean that being able to modify the
column,rows, andmetricoptions in theApp.jsfile - Bells and whistles were not included
- Dark mode
- UI configuration
- Frozen columns/rows
- Collapsing rows
- Real API feeding the data
- Supporting the bells and whistles that were not included in this implementation
- Support for multiple dimensions on columns
- Hooking the table up to a real data API