Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalizado #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,57 @@ function App() {
id: 0
})

const [pokemon1, setPokemon1] = useState({
name: "Bulbasaur",
type: "grass",
evolved: true,
weight: 6.9,
color: 'green',
image: 'https://archives.bulbagarden.net/media/upload/2/21/001Bulbasaur.png',
id: 1
})

const Evoluir = () => {
const novoPokemon = {
...pokemon,
color: `red`
}
setPokemon(novoPokemon)
}

const Evoluir1 = () => {
const novoPokemon1 = {
...pokemon1,
color: `red`
}
setPokemon1(novoPokemon1)
}



// Para fazer seus próximos pokemons, crie novos estados!

return ( <>
<GlobalStyles/>
<FlexContainer>
{/* Aqui neste componente, passe as props. Lembre-se que também é possivel passar a função de setState via props! */}
<PokemonCard/>
<PokemonCard name={pokemon.name}
type={pokemon.type}
evolved={pokemon.evolved}
weight={pokemon.weight}
color={pokemon.color}
image={pokemon.image}
evoluirPokemon={Evoluir} />
<PokemonCard
name={pokemon1.name}
type={pokemon1.type}
evolved={pokemon1.evolved}
weight={pokemon1.weight}
color={pokemon1.color}
image={pokemon1.image}
evoluirPokemon={Evoluir1}
/>

{/* Crie aqui seus próximos pokemons! */}
</FlexContainer>
</>
Expand Down
16 changes: 9 additions & 7 deletions src/Components/PokemonCard/PokemonCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import {Card, PokemonName, PokemonType, EvolveButton} from './styles'

const PokemonCard = (props) => {

const evoluirPokemon = () => {
const evoluirPokemon = () => {

console.log("Cliquei no botão de evoluir")
}

return (
<Card color={}>
<img src={} alt={`Pokemon`}/>
<PokemonName>{}</PokemonName>
<PokemonType>{}</PokemonType>
<p>{}kg</p>
<Card color={props.color}>
<img src={props.image} alt={`Pokemon`}/>
<PokemonName>{props.name}</PokemonName>
<PokemonType>{props.type}</PokemonType>
<p>{props.weight}kg</p>


<EvolveButton onClick={() => evoluirPokemon()}>Evoluir!</EvolveButton>
<EvolveButton onClick= {props.evoluirPokemon}>Evoluir!</EvolveButton>
</Card>
)
}
Expand Down