This project renders an interactive Sudoku grid UI for solving puzzles.
sudoku-api
for sudoku and solution generationeslint
rulesCTRL
key in handleKeyDown
and if found, "highlight" the cell. Probably need to track currently highlighted cells in redux. Highlighted cells can have special styling too.https://coolors.co
HoverGrid
component, implementation removed in favor of new pencil marking features.This project was bootstrapped with Create React App, so getting up and running is the standard:
npm install
npm start
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.
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
.
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>
}
TODO :)
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).
The UI and features for this app take inspiration from Duncan's SuDoku Solver and Cracking the Cryptic's solver.