-
Notifications
You must be signed in to change notification settings - Fork 62
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
Solicitando primer pull request #27
base: master
Are you sure you want to change the base?
Changes from 39 commits
6173414
f29ad25
4524efd
aa922d4
69aa0d7
d5ffc62
e3e15ae
1102c72
2b86974
5cb656e
7a85962
31a156d
e2417e1
ed6fd6b
5108f07
89225a2
8f7f167
5e34c69
3ac0ee7
e82380d
1813c3b
f140cc3
597da22
5f6e93a
d3529d8
a2fdad7
fc16d54
665d9a5
5b6b471
97b3778
91f25b5
c4139af
7e94613
c2a95a5
d64b5ae
4ecb997
d30c8d4
b5721d4
1155601
1ce6bdd
f17ef91
79c32d2
23d51ce
3d45eab
d051233
1c34545
3f0cfe5
81d0c41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
// import data from './data/injuries/injuries.js'; | ||
// import data from './data/lol/lol.js'; | ||
// import data from './data/patient/patient.js'; | ||
// import data from './data/pokemon/pokemon.js'; | ||
// import data from './data/rickandmorty/rickandmorty.js'; | ||
// import data from './data/steam/steam.js'; | ||
// import data from './data/steam/worldbank.js'; | ||
|
||
// esta es una función de ejemplo | ||
|
||
export const example = () => { | ||
return 'example'; | ||
}; | ||
import data from './data/pokemon/pokemon.js'; | ||
//Mostrar la data | ||
export const dataPokemon= data.pokemon; | ||
//Filtracion | ||
function onChange(e){ | ||
let value = e.target.value | ||
let nuevaListaFiltrada = data.pokemon.filter(p=>p.type.includes(value)) | ||
} | ||
//console.log(nuevaListaFiltrada) | ||
|
||
//Orden por numero de Pokedex | ||
export let numberPokedex= | ||
data.pokemon.sort((a, b)=>{ | ||
if(a.id< b.id){ | ||
return -1; | ||
} | ||
if (a.id> b.id){ | ||
return 1; | ||
} | ||
}); | ||
//console.log(numberPokedex) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,59 @@ | ||
import { example } from './data.js'; | ||
import {dataPokemon} from './data.js'; | ||
import pokemon from './data/pokemon/pokemon.js'; | ||
|
||
console.log(example); | ||
console.log(); | ||
//Nodos | ||
let closeModal = document.querySelectorAll(".close"); | ||
|
||
//Mostrar imagenes pantalla principal | ||
const images = dataPokemon.forEach((item) => { | ||
let image= item.img; | ||
let label= document.createElement('img'); | ||
label.id= ("a"+item.type) | ||
let btn= document.createElement('button'); | ||
btn.className+= ("btn-Images") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. className no existe en native, eso es de ReactJS, la forma de trabajar con clases en Vanilla es:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eviten usar clases con mayusculas o camelCase, |
||
btn.id+= item.id | ||
btn.appendChild(label); | ||
label.src= image; | ||
let node= btn; | ||
document.getElementById("boxImages").appendChild(node); | ||
}); | ||
//Modal Información Pokemon | ||
|
||
let btnImg = document.querySelectorAll('.btn-Images'); | ||
let Imgs = document.querySelector('#a') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eviten las mayusculas en las variables, a menos que se entienda qué es una clase (JS) y porqué se usan Mayusculas en una declaración de clase, bien por el uso de querySelector |
||
btnImg.forEach(poke =>{ | ||
let a = poke.id -1; | ||
|
||
const showData = () => { | ||
|
||
document.getElementById("modalPokemon").style.display="block"; | ||
let container= document.getElementById("contentInfo"); | ||
document.createElement('div'); | ||
container.innerHTML=` | ||
<h3 class="num"> ${dataPokemon[a].num}</h3> | ||
<h4 class= "name"> ${dataPokemon[a].name}</h4> | ||
<div class= "img-contain"> <img class="img poke" src='${dataPokemon[a].img}' /> </div> | ||
<p class="type"> Tipo: ${dataPokemon[a].type} </p> | ||
<p class="weigth"> Peso: ${dataPokemon[a].weight} Altura: ${dataPokemon[a].height} </p> | ||
<p class="candy"> Dulces: ${dataPokemon[a].candy_count} ${dataPokemon[a].candy}</p> | ||
<p class="egg"> Tipo de huevo: ${dataPokemon[a].egg}</p> | ||
<p class="average spawn"> Frecuencia de aparición: ${dataPokemon[a].avg_spawns}</p>` | ||
} | ||
poke.addEventListener('click',showData) | ||
}); | ||
closeModal.forEach(closeModalPoke=>{ | ||
closeModalPoke.addEventListener('click',function(){ | ||
document.getElementById("modalPokemon").style.display = 'none';}) | ||
}); | ||
|
||
//Filtración | ||
let options= document.querySelector(".dropdown-content"); | ||
options.addEventListener('click',onChange) | ||
|
||
function onChange(e){ | ||
let value = e.target.value | ||
let nuevaListaFiltrada = dataPokemon.filter(p=>p.type.includes(value)) | ||
console.log(nuevaListaFiltrada) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Evitar español, y cuidado con la identación de las funciones, lo vuelve difícil de leer |
||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
background: linear-gradient(to right,#FF6950, #FF3050); | ||
font-family: 'Open Sans'; | ||
} | ||
|
||
.logo { | ||
height: 77.98px; | ||
width: 90px; | ||
} | ||
|
||
.container { | ||
background: linear-gradient(to right,#FF6950, #FF3050); | ||
width: 100%; | ||
max-width: 1500vw; | ||
height: 150vh; | ||
/* background: #ffffff; */ | ||
margin: auto; | ||
/*Flex*/ | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
} | ||
|
||
header{ | ||
width: 100%; | ||
padding: 20px; | ||
height: 150px; | ||
/*Flex*/ | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
} | ||
|
||
header nav { | ||
list-style-type: none; | ||
width: 50%; | ||
/*Flex*/ | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
} | ||
|
||
header nav a { | ||
border: 1px solid #ffffff; | ||
margin-left: 30px; | ||
margin-right: 30px; | ||
width: 200px; | ||
height: 55px; | ||
border-radius: 30px; | ||
text-align: center; | ||
text-decoration: none; | ||
padding: 10px; | ||
display: block; | ||
font-family: 'Open Sans'; | ||
/*Flex*/ | ||
flex-grow: 1; | ||
} | ||
|
||
main { | ||
/* background-color: yellowgreen; */ | ||
padding: 10px; | ||
/*Flex*/ | ||
flex: 1 1 100%; | ||
} | ||
|
||
main .dinamic { | ||
margin-bottom: 20px; | ||
padding-bottom: 20px; | ||
/*Flex*/ | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
padding: 5px; | ||
} | ||
|
||
main section .bienvenida { | ||
flex: 0 0 382px; | ||
} | ||
|
||
main div img { | ||
height: 80px; | ||
width: 80px; | ||
} | ||
|
||
li a, .dropbtn { | ||
color: white; | ||
text-align: center; | ||
/* padding: 14px 16px; Desacomoda el desplegable a forma hotizontal*/ | ||
text-decoration: none; | ||
} | ||
|
||
li a:hover, dropdown:hover .dropbtn { | ||
background-color: white; | ||
color: #FF3050; | ||
} | ||
|
||
/*cajas contenedoras de texto para tipos de pokemon*/ | ||
.dropdown-content { | ||
/* display: none; */ | ||
min-width: 160px; | ||
z-index: 1; | ||
position: absolute; /*Hizo que el menú multinivel apareciera vertical*/ | ||
} | ||
|
||
/*texto para tipos de pokemon*/ | ||
.dropdown-content a { | ||
background-color: #ffffff; | ||
color:#FF3050; | ||
border-radius: 0px; | ||
text-decoration: none; | ||
display: block; /*Hace de forma vertical el acomodo desplegable*/ | ||
text-align: center; | ||
} | ||
|
||
.dropdown-content a:hover { | ||
color: #ffffff; | ||
background-color:#FF6950; | ||
} | ||
|
||
.dropdown:hover .dropdown-content { | ||
display: block; | ||
} | ||
|
||
footer { | ||
width: 100%; | ||
padding: 20px; | ||
background: red; | ||
display: flex; | ||
flex-wrap: wrap; | ||
color: white; | ||
text-decoration: none; | ||
} | ||
|
||
img { | ||
width: 160vw; | ||
height: 160vh; | ||
} | ||
|
||
@media screen and (max-width: 10vw) { | ||
.container { | ||
flex-direction: column; | ||
} | ||
header { | ||
flex-direction: column; | ||
padding: 0; | ||
} | ||
header img { | ||
margin: 20px 0; | ||
} | ||
header nav { | ||
width: 100%; | ||
} | ||
} | ||
/* Modal Ranking */ | ||
.modal-container{ | ||
display: none; | ||
position: fixed; | ||
z-index: 1; | ||
overflow: auto; | ||
left: 20vw; | ||
top: 20vh; | ||
width: 60%; | ||
height: 60%; | ||
background: rgb(238, 235, 235); | ||
} | ||
.contenido-modal{ | ||
position: relative; | ||
background-color: rgb(214, 210, 210); | ||
margin: auto; | ||
width: 30%; | ||
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.4); | ||
} | ||
.close{ | ||
color: rgb(3, 3, 3); | ||
font-size: 30px; | ||
font-weight: bold; | ||
} | ||
.close:hover{ | ||
color: rgb(224, 30, 30); | ||
text-decoration: none; | ||
cursor: pointer; | ||
} | ||
/* Modal Información Pokemon */ | ||
.modalPokemon{ | ||
display: none; | ||
position: fixed; | ||
z-index: 1; | ||
overflow: auto; | ||
left: 20vw; | ||
top: 20vh; | ||
width: 20%; | ||
height: 50%; | ||
background: rgb(238, 235, 235); | ||
} | ||
.contenido-modal-pokemon{ | ||
position: relative; | ||
background-color: rgb(214, 210, 210); | ||
margin: auto; | ||
width: 60%; | ||
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.4); | ||
} | ||
.closePokemon{ | ||
color: rgb(3, 3, 3); | ||
font-size: 30px; | ||
font-weight: bold; | ||
} | ||
.closePokemon:hover{ | ||
color: rgb(224, 30, 30); | ||
text-decoration: none; | ||
cursor: pointer; | ||
} | ||
|
||
.btn-Images{ | ||
background-color: transparent; | ||
border: transparent; | ||
} | ||
|
||
/* | ||
.button { | ||
display: block; | ||
padding: 15px 20px; | ||
background-color: transparent; | ||
border: 1px solid #ffffff; | ||
margin-left: 30px; | ||
margin-right: 30px; | ||
width: 200px; | ||
height: 55px; | ||
border-radius: 30px; | ||
font-family: 'Open Sans'; | ||
font-weight: bold; | ||
color: white; | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto pudo crearse dinámicamente con la misma data de los pokemons.