React Sudoku
This project was bootstrapped with Create React App and based on SuGOku.
Available Scripts
In the project directory, you can run:
npm start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
npm test
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
npm run build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Highlights
- Keyboard navigation: Navigate to the board using
tab
, use ⬆️⬇️⬅️➡️ to navigate through grid, pressenter
to select the input and confirm value - Undo/redo: If you make a mistake, use the
undo
button to go back. Use theredo
button to go forward. - Restore game: If you close the app, your game is saved locally and is restored when you come back.
- Light/Dark mode: If you have a system theme preference set, the game will load using that theme. The theme can be changed using the toggle in the header.
- There is a branch that uses Axios for the API calls, if you feel strongly about using Axios over
fetch
: github.com/pwoidke/react-sudoku/tree/feature/axios
Packages & Dependencies
I used several packages & dependencies to build this app. Some of the notable ones are listed here.
- @mattflow/sudoku-solver: Provides function to solve sudoku puzzle given a list of cell values
- classnames: Used to conditionally set class names
- enzyme: Used for unit testing components
- pretty-checkbox: I usually use (
react-toggle-button
) for toggle buttons, but I was having a dependency issue so I usedpretty-checkbox
instead (it's not as nice, but it works). - react-media-hook: Used to get the system light/dark mode selection
- react-spinners: Loading indicator
- react-toastify: Used to display error messages and the "puzzle solved" image
- store.js: Set/get local storage items
Things I wanted to do but didn't have time
- Add unit tests for
Controls
,GameControls
,GameInfo
,NewGameButtons
,Cell
, andButton
components - Highlight validation issues (row/column/block)
- Test w/ screen reader
- Move SCSS vars to constants
- JSDocs
font awesomeUsing emojis for simplicityRTK?Fetch is fine since there's just 1 API callFeature flags?Can't think of anything worth the effort to add them