mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
Styled victory and defeat
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const Defeat = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="defeat animate__animated animate__backInDown">
|
||||
<h1>DEFEAT</h1>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -3,9 +3,9 @@ import Register_Input from '../../Scripts/Register input'
|
||||
import Defeat from './Defeat'
|
||||
import Victory from './Victory'
|
||||
|
||||
const PuzzleWord = ({hangmanFrame, setHangmanFrame}) => {
|
||||
const PuzzleWord = ({hangmanFrame, setHangmanFrame, currentScore, setCurrentScore}) => {
|
||||
|
||||
const [actualWord, setActualWord] = useState('murcielago')
|
||||
const [actualWord, setActualWord] = useState('papa')
|
||||
const [isVictory, setIsVictory] = useState(false)
|
||||
const [isDefeat, setIsDefeat] = useState(false)
|
||||
|
||||
@@ -47,7 +47,7 @@ const PuzzleWord = ({hangmanFrame, setHangmanFrame}) => {
|
||||
<>
|
||||
<div className="puzzleWord" id="puzzleWord"></div>
|
||||
|
||||
{isVictory ? <Victory /> : null}
|
||||
{isVictory ? <Victory currentScore={currentScore} setCurrentScore={setCurrentScore} /> : null}
|
||||
{isDefeat ? <Defeat /> : null}
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import React from 'react'
|
||||
|
||||
const Victory = () => {
|
||||
const Victory = ({currentScore, setCurrentScore}) => {
|
||||
|
||||
React.useEffect(() => {
|
||||
|
||||
setCurrentScore(currentScore + 1)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="victory animate__animated animate__backInDown">
|
||||
<h1>VICTORIA</h1>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user