mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
bugs fix
This commit is contained in:
@@ -150,18 +150,18 @@ header h2 {
|
|||||||
animation: bounce;
|
animation: bounce;
|
||||||
animation-duration: 0.5s;
|
animation-duration: 0.5s;
|
||||||
}
|
}
|
||||||
.categories-container .categories button.Pokemon, .categories-container .categories select.Pokemon {
|
.categories-container .categories button.Pokemons, .categories-container .categories select.Pokemons {
|
||||||
color: #000;
|
color: #000;
|
||||||
background-color: #ffcb05;
|
background-color: #ffcb05;
|
||||||
border: #f7c505 solid 2px;
|
border: #f7c505 solid 2px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: 0.4s ease-in-out;
|
transition: 0.4s ease-in-out;
|
||||||
}
|
}
|
||||||
.categories-container .categories button.Pokemon:hover, .categories-container .categories select.Pokemon:hover {
|
.categories-container .categories button.Pokemons:hover, .categories-container .categories select.Pokemons:hover {
|
||||||
background-color: #ffd638;
|
background-color: #ffd638;
|
||||||
transition: 0.4s ease-in-out;
|
transition: 0.4s ease-in-out;
|
||||||
}
|
}
|
||||||
.categories-container .categories button.Pokemon:hover img, .categories-container .categories select.Pokemon:hover img {
|
.categories-container .categories button.Pokemons:hover img, .categories-container .categories select.Pokemons:hover img {
|
||||||
animation: bounce;
|
animation: bounce;
|
||||||
animation-duration: 0.5s;
|
animation-duration: 0.5s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
@include backgroundAndHoverDefiner($buttonColor);
|
@include backgroundAndHoverDefiner($buttonColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.Pokemon {
|
&.Pokemons {
|
||||||
$buttonColor: #ffcb05;
|
$buttonColor: #ffcb05;
|
||||||
|
|
||||||
@include backgroundAndHoverDefiner($buttonColor);
|
@include backgroundAndHoverDefiner($buttonColor);
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ function App() {
|
|||||||
<Header
|
<Header
|
||||||
language={language}
|
language={language}
|
||||||
|
|
||||||
|
category={category}
|
||||||
|
|
||||||
displayCategories={displayCategories}
|
displayCategories={displayCategories}
|
||||||
setDisplayCategories={setDisplayCategories}
|
setDisplayCategories={setDisplayCategories}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const BringTheWords = async (language = false, category = false, selectedWord) =
|
|||||||
|
|
||||||
|
|
||||||
console.log(category)
|
console.log(category)
|
||||||
|
console.log(language)
|
||||||
|
|
||||||
if (!language) {
|
if (!language) {
|
||||||
|
|
||||||
@@ -28,8 +29,10 @@ const BringTheWords = async (language = false, category = false, selectedWord) =
|
|||||||
const data = collection(db, `hangman_words/${language}/${category}`)
|
const data = collection(db, `hangman_words/${language}/${category}`)
|
||||||
const result = await getDocs(data)
|
const result = await getDocs(data)
|
||||||
|
|
||||||
|
|
||||||
const words = await result.docs.map(doc => doc.id)
|
const words = await result.docs.map(doc => doc.id)
|
||||||
const word = await SelectRandomWord(await words)
|
const word = await SelectRandomWord(await words)
|
||||||
|
|
||||||
return await word
|
return await word
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ const SelectRandomWord = (arrayWords) => {
|
|||||||
|
|
||||||
Math.random() * (arrayWords.length - 0) + 0
|
Math.random() * (arrayWords.length - 0) + 0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (arrayWords[randomWord] === undefined) {
|
||||||
|
|
||||||
|
return SelectRandomWord()
|
||||||
|
}
|
||||||
|
|
||||||
return arrayWords[randomWord]
|
return arrayWords[randomWord]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ const checkDefeat = (setEndOfGame, hangmanFrame, setCorrectLetters, selectedWord
|
|||||||
if (hangmanFrame >= 5) {
|
if (hangmanFrame >= 5) {
|
||||||
setCorrectLetters([...selectedWord])
|
setCorrectLetters([...selectedWord])
|
||||||
setEndOfGame('Defeat')
|
setEndOfGame('Defeat')
|
||||||
|
|
||||||
|
navigator.keyboard.lock();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const images = {
|
|||||||
countries: countries,
|
countries: countries,
|
||||||
países: countries,
|
países: countries,
|
||||||
|
|
||||||
pokemon: pokemon,
|
pokemons: pokemon,
|
||||||
|
|
||||||
'programming languages': programmingLanguage,
|
'programming languages': programmingLanguage,
|
||||||
'lenguajes de programación': programmingLanguage,
|
'lenguajes de programación': programmingLanguage,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, {useState} from 'react'
|
import React, {useState} from 'react'
|
||||||
|
|
||||||
const Header = ({language, displayCategories, setDisplayCategories}) => {
|
const Header = ({language, category, displayCategories, setDisplayCategories}) => {
|
||||||
|
|
||||||
const [title, setTitle] = useState('')
|
const [title, setTitle] = useState('')
|
||||||
const [categoryText, setCategoryText] = useState('')
|
const [categoryText, setCategoryText] = useState('')
|
||||||
@@ -18,7 +18,18 @@ const Header = ({language, displayCategories, setDisplayCategories}) => {
|
|||||||
setTitle('Ahorcado')
|
setTitle('Ahorcado')
|
||||||
setCategoryText('Seleccionar categoría')
|
setCategoryText('Seleccionar categoría')
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
if (category) {
|
||||||
|
|
||||||
|
console.log(category);
|
||||||
|
|
||||||
|
let categoryText = category.split('')
|
||||||
|
categoryText[0] = categoryText[0].toUpperCase()
|
||||||
|
|
||||||
|
setCategoryText(categoryText)
|
||||||
|
}
|
||||||
|
|
||||||
|
}, [category])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header>
|
<header>
|
||||||
|
|||||||
Reference in New Issue
Block a user