Skip to content

Commit

Permalink
refactor and fix some small things
Browse files Browse the repository at this point in the history
  • Loading branch information
huoyijie committed Nov 8, 2023
1 parent 10ed92b commit 35d231d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/Board.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function Board() {
))}
<BoardBgCubes />
{gameOver && (
<div className='absolute top-0 left-0 w-full h-full z-100 bg-white opacity-50 flex items-center justify-center'>
<span className='text-4xl font-bold'>Game Over</span>
<div className='absolute top-0 left-0 w-full h-full z-100 bg-white opacity-75 flex items-center justify-center'>
<span className='text-6xl font-bold'>Game Over</span>
</div>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Info.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import t from '@/lib/time'
const { h, m, s } = t()

export default function Info() {
const { gameOver, time, nextTetromino, score, eliminatedLines, level } = useContext(Context)
const { time, nextTetromino, score, eliminatedLines, level } = useContext(Context)

if (gameOver) return <></>
if (!time) return <></>
const duration = Date.now() - time

return (
Expand Down
2 changes: 2 additions & 0 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export default function Home() {
setNextTetromino(randomTetromino())
setGameOver(false)
setTime(Date.now())
setScore(0)
setEliminatedLines(0)
}
}

Expand Down

0 comments on commit 35d231d

Please sign in to comment.