Jamescan / sudoku-ui

Sudoku UI app complete with pencil-marking, automatic input validation, etc.
0 stars 0 forks source link

This project renders an interactive Sudoku grid UI for solving puzzles.

Features

Current

Planned

Removed

Installation and Use

This project was bootstrapped with Create React App, so getting up and running is the standard:

npm install

npm start

Development Notes

API Integration

Currently (in development) the UI setups a CRA proxy to localhost:4000, where the sudoku-api is expected to be running, listening for requests. This means that while the UI runs on localhost:3000, API requests will appear to be coming from localhost:4000 thanks to CRA. This avoids some CORS issues - more info here.

Linting

We use the airbnb eslint configuration as our baseline linting setup, with some minor rule modifications (see the package.json file). We also use the standard stylelint-config for linting our CSS. Our eslint + stylelint + prettier setup is run as a precommit hook using husky and lint-staged.

Styling

CSS Modules

We make use of Create React App's built-in support (as of v2) for CSS Modules which scopes styles to avoid className collisions. This requires importing and using our stylesheets like so:

import styles from "styleSheetName.module.css"

// ...
render() {
    return <div className={styles.foo}></div>
}

as opposed to:

import "styleSheetName.css"

// ...
render() {
    return <div className="foo"></div>
}

Sass

TODO :)

Testing

We use react-testing-library to test the app since RTL encourages good quality, maintainable tests that don't focus on implementation details.

The standard npm test will run the app's test suite. To get a coverage report, you can run npm test -- --coverage or use the coverage script via npm run coverage (defined in the package.json file).

Acknowledgements

The UI and features for this app take inspiration from Duncan's SuDoku Solver and Cracking the Cryptic's solver.