Skip to content

Commit

Permalink
fix mobile layout and unpause on change for sudoku
Browse files Browse the repository at this point in the history
  • Loading branch information
ayan4m1 committed Dec 29, 2023
1 parent 5c61560 commit 2368779
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/components/sudokuBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,18 @@ export default function SudokuBoard({ mode }) {
}),
[]
);
const handleChange = useCallback(
(row, column, value) =>
setValues((prevVal) => {
const newVal = [...prevVal];
const newRow = [...newVal[row]];
const handleChange = useCallback((row, column, value) => {
setValues((prevVal) => {
const newVal = [...prevVal];
const newRow = [...newVal[row]];

newRow[column] = value;
newVal.splice(row, 1, newRow);
newRow[column] = value;
newVal.splice(row, 1, newRow);

return newVal;
}),
[]
);
return newVal;
});
setPaused(false);
}, []);
const handleNew = useCallback((difficulty) => {
setCurrentTime(Date.now());
setPuzzle(getSudoku(difficulty));
Expand Down Expand Up @@ -167,11 +166,14 @@ export default function SudokuBoard({ mode }) {
<Card body>
<Container fluid>
<Row>
<Col xs={mode === 'timed' ? 8 : 12}>
<Col xs={8}>
<h1>Sudoku</h1>
</Col>
{mode === 'timed' && (
<Col className="d-flex justify-content-center align-items-center">
<Col
xs={4}
className="d-flex justify-content-center align-items-center"
>
<span className="font-monospace">
{formatTime(currentTime, startTime)}
</span>
Expand Down

0 comments on commit 2368779

Please sign in to comment.