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

Adição de Botão para "Voltar ao Topo" #314

Open
wants to merge 4 commits 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
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
# Trilha JS Developer - Pokedex
# Pokédex 🐾

Este projeto é baseado em uma aplicação desenvolvida durante um bootcamp da **DIO (Digital Innovation One)**. A aplicação exibe uma Pokédex com os 151 Pokémons da primeira geração e foi customizada e ampliada após o fork.

---

## 📋 Funcionalidades

- Listagem dinâmica dos 151 Pokémons da primeira geração.
- Paginação com carregamento incremental (botão "Carregar mais").
- Visual agradável e responsivo, adaptado para diversos dispositivos.
- Adição de botão "voltar ao topo" para uma melhor experiência do usuário.
- Identificação visual por tipo de Pokémon com cores exclusivas.

---

## 🛠️ Tecnologias Utilizadas

- **HTML5** para estruturação da página.
- **CSS3** para estilização.
- **JavaScript** para lógica e consumo da API.
- **PokeAPI** como fonte de dados para os Pokémons.

---

## 🤝 Créditos e Contribuições

Este projeto foi desenvolvido originalmente pela **Digital Innovation One (DIO)** como parte de seu bootcamp.
Contribuições são bem-vindas!
52 changes: 34 additions & 18 deletions assets/css/pokedex.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.pokemons {
list-style: none;
padding: 0;
margin: 0;
display: grid;
grid-template-columns: 1fr;
margin: 0;
padding: 0;
list-style: none;
}

.normal {
Expand Down Expand Up @@ -79,11 +79,11 @@
}

.pokemon {
display: flex;
flex-direction: column;
margin: .5rem;
padding: 1rem;
padding: 2rem 1rem;
border-radius: 1rem;
display: flex;
flex-direction: column;
}

.pokemon .number {
Expand All @@ -94,11 +94,10 @@
}

.pokemon .name {
text-transform: capitalize;
color: #fff;
margin-bottom: .25rem;
margin: .25rem 0;
text-transform: capitalize;
}

.pokemon .detail {
display: flex;
flex-direction: row;
Expand All @@ -115,7 +114,7 @@
.pokemon .detail .types .type {
color: #fff;
padding: .25rem .5rem;
margin: .25rem 0;
margin: .25rem 0;
font-size: .625rem;
border-radius: 1rem;
filter: brightness(1.1);
Expand All @@ -125,6 +124,7 @@
.pokemon .detail img {
max-width: 100%;
height: 70px;
align-self: flex-end;
}

.pagination {
Expand All @@ -137,29 +137,45 @@
}

.pagination button {
padding: .25rem .5rem;
margin: .25rem 0;
font-size: .625rem;
color: #fff;
background-color: #6c79db;
border: none;
border-radius: 1rem;
color: #fff;
padding: .25rem 0.5rem;
margin: .25rem 0;
font-size: .625rem;
}

#scrollTopButton {
position: fixed;
bottom: 20px;
right: 20px;
background: #e600fa;
color: white;
border: none;
border-radius: 50%;
padding: 10px 15px;
cursor: pointer;
}

#scrollTopButton.hidden {
display: none;
}

@media screen and (min-width: 380px) {
.pokemons {
.pokemons{
grid-template-columns: 1fr 1fr;
}
}

@media screen and (min-width: 576px) {
.pokemons {
.pokemons{
grid-template-columns: 1fr 1fr 1fr;
}
}

@media screen and (min-width: 992px) {
.pokemons {
.pokemons{
grid-template-columns: 1fr 1fr 1fr 1fr;
}
}
}
15 changes: 14 additions & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const pokemonList = document.getElementById('pokemonList')
const loadMoreButton = document.getElementById('loadMoreButton')
const scrollTopButton = document.getElementById('scrollTopButton')

const maxRecords = 151
const limit = 10
Expand Down Expand Up @@ -44,4 +45,16 @@ loadMoreButton.addEventListener('click', () => {
} else {
loadPokemonItens(offset, limit)
}
})
})

window.addEventListener('scroll', () => {
if (window.scrollY > 200) {
scrollTopButton.classList.remove('hidden');
} else {
scrollTopButton.classList.add('hidden');
}
});

scrollTopButton.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
})
39 changes: 19 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<!DOCTYPE html>
<html lang="pt-BR">

<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pokedex</title>

<!-- Normalize CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
integrity="sha512-NhSC1YmyruXifcj/KFRWoC561YpHpc5Jtzgvbuzx5VozKpWvQ+4nXhPdFgmx8xqexRcpAglTj9sIBWINXa8x5w=="
crossorigin="anonymous" referrerpolicy="no-referrer" />

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha512-NhSC1YmyruXifcj/KFRWoC561YpHpc5Jtzgvbuzx5VozKpWvQ+4nXhPdFgmx8xqexRcpAglTj9sIBWINXa8x5w==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<!-- Font Roboto -->
<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=Roboto:wght@100;300;500;700&display=swap" rel="stylesheet">

<!-- Nosso CSS -->
<link rel="stylesheet" href="/assets/css/global.css">
<link rel="stylesheet" href="/assets/css/pokedex.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<!-- Link CSS -->
<link rel="stylesheet" href="./assets/css/global.css">
<link rel="stylesheet" href="./assets/css/pokedex.css">
</head>

<body>

<section class="content">
<h1>Pokedex</h1>

Expand All @@ -35,12 +31,15 @@ <h1>Pokedex</h1>
Load More
</button>
</div>
</section>

<!-- Nosso JS -->
<script src="/assets/js/pokemon-model.js"></script>
<script src="/assets/js/poke-api.js"></script>
<script src="/assets/js/main.js"></script>
<div>
<button id="scrollTopButton" class="hidden">⬆ Topo</button>
</div>

</section>
<!-- Link JS -->
<script src="./assets/javascript/pokemon-model.js"></script>
<script src="./assets/javascript/poke-api.js"></script>
<script src="./assets/javascript/main.js"></script>
</body>

</html>
</html>