Skip to content

Commit

Permalink
Botão de zerar e paleta de cores
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelWasconcelos committed Dec 24, 2023
1 parent 71db0e0 commit a62c57a
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 10 deletions.
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com/" />
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&family=Preahvihear&display=swap"
rel="stylesheet"
/>
<title>Jogo da Velha - MACHADÂMBAR</title>
</head>
<body>
Expand Down
15 changes: 14 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import './App.css'
import {Tabuleiro} from "./components/Tabuleiro"
import { Pontuacao } from "./components/Pontuacao";
import { BotaoRecomeca } from "./components/BotaoRecomeca";
import { ZerarPontuacao } from "./components/ZerarPontuacao";

function App() {

Expand Down Expand Up @@ -66,12 +67,24 @@ function App() {
setFimdeJogo(false)
setTabuleiro(Array(9).fill(null))
}
const zerarJogo = (updatedTabuleiro) => {
setFimdeJogo(false)
setTabuleiro(Array(9).fill(null))
let {oPontos} = pontos;
oPontos = 0
setPontos({...pontos, oPontos})
let {xPontos} = pontos;
xPontos = 0
setPontos({...pontos, xPontos})


}
return (
<div className='App'>
<Pontuacao pontos={pontos} xJogando={xJogando}/>
<Tabuleiro tabuleiro={tabuleiro} onClick={fimdeJogo ? recomecarJogo : handleCelulaClick} />
<BotaoRecomeca recomecarJogo={recomecarJogo} />
<BotaoRecomeca recomecarJogo={recomecarJogo} />
<ZerarPontuacao zerarJogo={zerarJogo}/>
</div>
)

Expand Down
1 change: 1 addition & 0 deletions src/components/BotaoRecomeca.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
background-color: #3d0505;
color: white;
font-size: 2rem;
font-family: 'Preahvihear', sans-serif;
padding: 0.5rem 1rem;
margin: 2rem auto;
display: block;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Celula.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.celula {
background-color: #fff;
background-color: rgba(204, 92, 41, 0.7);;
border: none;
border-radius: 10%;
box-shadow: 0px 0px 8px #000000;
width: 5rem;
height: 5rem;
text-align: center;
font-size: 5em;
font-family: 'Courier New', Courier, monospace;
font-family: 'Preahvihear', sans-serif;
font-weight: bold;
line-height: 5rem;
margin: 0.5rem;
Expand All @@ -18,7 +18,7 @@
}

.o {
color: rgb(44,135,255);
color: rgb(255, 196, 0);
}

.celula:hover {
Expand Down
11 changes: 6 additions & 5 deletions src/components/Pontuacao.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
justify-content: space-evenly;
width: 20rem;
font-size: 1.5em;
background-color: #ffff;
font-family: 'Preahvihear', sans-serif;
background-color: rgba(63, 18, 18, 0.7);;
margin: 3rem auto;
box-shadow: 0px 0px 8px #888;
border-radius: 0.5rem;
Expand All @@ -20,16 +21,16 @@

.x-ponto {
color: red;
border-bottom: 5px solid red;
border: 5px solid red;
border-radius: 0.5rem 0 0 0.5rem;
}

.o-ponto {
color: blue;
border-bottom: 5px solid blue;
color: rgb(255, 196, 0);
border: 5px solid rgb(255, 196, 0);
border-radius: 0 0.5rem 0.5rem 0;
}

.inactive {
border-bottom: 5px solid transparent;
border: 5px solid transparent;
}
11 changes: 11 additions & 0 deletions src/components/ZerarPontuacao.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.zerarJogo{
border: none;
border-radius: 0.5rem;
background-color: #3d0505;
color: white;
font-size: 2rem;
font-family: 'Preahvihear', sans-serif;
padding: 0.5rem 1rem;
margin: 2rem auto;
display: block;
}
9 changes: 9 additions & 0 deletions src/components/ZerarPontuacao.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";

import "./ZerarPontuacao.css"

export const ZerarPontuacao = ({zerarJogo}) => {
return (
<button className="zerarJogo" onClick={zerarJogo}>Zerar placar</button>
)
}
3 changes: 2 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:root {
/* font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;

/*
line-height: 1.5;
font-weight: 400;
Expand Down

0 comments on commit a62c57a

Please sign in to comment.