-
Notifications
You must be signed in to change notification settings - Fork 61
Data Lovers - pokémon #39
base: master
Are you sure you want to change the base?
Changes from all commits
0a5cbe4
bf0dfda
51e81e8
7c2c6db
281c5d1
14241e6
a9ac71c
a654845
2a5d09f
58e9cbc
1debeba
a93b3e0
b67f760
eb426c6
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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "path": "." | ||
| }, | ||
| { | ||
| "path": "/Users/zayrajeronimo/Documents/Laboratoria/Proyecto2/CDMX009-Data-Lovers/img" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,26 @@ | ||
| // 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/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'; | ||
| }; | ||
|
|
||
|
|
||
|
|
||
| const filterData = (data, condition) => { | ||
| let arrType = []; | ||
| for (let i = 0; i < data.length; i++) { | ||
| for (let x = 0; x < data[i].type.length; x++) { | ||
| if (data[i].type[x] === condition) { | ||
| arrType.push(data[i]); | ||
| } | ||
| } | ||
| } | ||
| return arrType; | ||
| }; | ||
|
|
||
| export {sortData, filterData} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,111 @@ | |
| <html lang="es"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Data Lovers</title> | ||
| <title>PokémonGO</title> | ||
| <link rel="icon" type="image/png" sizes="128x128" href="img/pokeball.png" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
| <link rel="stylesheet" href="style.css" /> | ||
| <link rel="stylesheet" href="style.css" > | ||
|
|
||
| <script type="module" src="main.js"></script> | ||
|
|
||
|
|
||
| </head> | ||
|
|
||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="main.js"></script> | ||
|
|
||
| <div class="container container-1" id="start-page"> | ||
| <img src="img/pokemon-go.png" id="logo"> | ||
| <img src="img/pokedex.png" id="pokedex"> | ||
| <h3 id="welcome">¿Estas listo para convertirte en <br> un verdadero maestro Pokémon?</h3> | ||
| <input class="button-next" type="image" onclick="nextContainer('start-page','pokemon-page');" img src="img/go-logo.png" alt="Go" width="auto" height="50px"> | ||
| </div> | ||
|
|
||
|
|
||
|
Contributor
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. Recuerden borrar los espacios innecesarios :) |
||
|
|
||
| <section> | ||
| <div class="container container-2" id="pokemon-page"> | ||
|
|
||
| <div class="logo"> | ||
|
Contributor
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. Recuerden que las clases deben ser más descriptivas, se deben nombrar en relación a lo que contienen y no a lo que hacen, container-2 no es muy descriptiva |
||
| <img src="img/pokedex-logo.png"> | ||
| </div> | ||
|
|
||
| <!--Segunda parte menu--> | ||
|
|
||
| <div class="container-bar" id="btn-menu"> | ||
|
Contributor
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. La clase debe ser lo suficientemene descriptiva para que no se necesiten comentarios. |
||
|
|
||
| <nav> | ||
| <ul> | ||
| <li><a href="">Región</a> | ||
| <ul> | ||
| <li><a href="#" id= "kanto">Kanto</a></li> | ||
|
|
||
| <!-- <div class="shadow"> | ||
| <li><a>Johto</a></li> | ||
| <li><a>Sinnoh</a></li> | ||
| <li><a>Hoenn</a></li> | ||
| </div>--> | ||
| </ul> | ||
| </li> | ||
|
|
||
|
Contributor
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. Si este código no se v a utilizar, debemos eliminarlo. |
||
| <li><a href="" id="typePokemon">Tipo</a> | ||
|
|
||
| <ul> | ||
| <li><a href="#" id="All">Ver todos</a></li> | ||
| <li><a href="#" id="Water">Agua</a></li> | ||
| <li><a href="#" id="Bug">Bicho</a></li> | ||
| <li><a href="#" id="Dragon">Dragón</a></li> | ||
| <li><a href="#" id="Electric">Eléctrico</a></li> | ||
| <li><a href="#" id="Ghost">Fantasma</a></li> | ||
| <li><a href="#" id="Fire">Fuego</a></li> | ||
| <li><a href="#" id="Ice">Hielo</a></li> | ||
| <li><a href="#" id="Fighting">Lucha</a></li> | ||
| <li><a href="#" id="Normal">Normal</a></li> | ||
| <li><a href="#" id="Grass">Hierba</a></li> | ||
| <li><a href="#" id="Psychic">Psíquico</a></li> | ||
| <li><a href="#" id="Rock">Roca</a></li> | ||
| <li><a href="#" id="Ground">Tierra</a></li> | ||
| <li><a href="#" id="Poison">Veneno</a></li> | ||
| <li><a href="#" id="Flying">Volador</a></li> | ||
| </ul> | ||
|
|
||
| </li> | ||
| </ul> | ||
|
|
||
| </nav> | ||
|
|
||
|
|
||
| <div class="logo-go"> | ||
|
|
||
| <input type="image" onclick="filterData"('typePokemon') img src="img/go-logo copia.png" class="logo-go"></button> | ||
|
|
||
| </div> | ||
|
|
||
|
|
||
|
|
||
| <div class="search_bar"> | ||
| <form action="#" id="search" method="post" class="formulario"> | ||
| <a class="search-btn"></a> | ||
| <input class="search-txt" type="text" id="barra" placeholder="Búsqueda..." class="src" autocomplete="off"> | ||
|
|
||
| </form> | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
||
| </section> | ||
|
|
||
| <div class="pokemon-list"> | ||
| <div class="main-container" id="pokemon-listing"></div> <!-- Contenedor de todos los pokemones--> | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
||
|
|
||
| <!-- <script src="data.js"></script>--> | ||
| <!-- <script src="main.js"></script>--> | ||
|
|
||
|
|
||
|
|
||
|
Contributor
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. Borrar código que no utilizamos! :) |
||
| </body> | ||
| </html> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,90 @@ | ||
| import { example } from './data.js'; | ||
| import data from './data/pokemon/pokemon.js'; | ||
|
|
||
| console.log(example); | ||
| console.log(data); | ||
|
|
||
| function nextContainer(idHideContainer, idNextContainer) { //Funcion para oculpar la primera pagina | ||
| document.getElementById(idNextContainer).style.display = 'block'; | ||
| document.getElementById(idHideContainer).style.display = 'none'; | ||
| } | ||
|
|
||
| window.nextContainer = nextContainer; | ||
|
|
||
| //function ShowContainerPokemon(){ | ||
|
|
||
| //} | ||
|
|
||
| function createPokemonItemHTML(pokemonObj) { | ||
| const name = pokemonObj.name, imgUrl = pokemonObj.img, id = pokemonObj.id; | ||
| let HTML = `<div class="pokemon-item-container pokemon" id="pokemon-item-${id}"> | ||
| <div class="pokemon-item-img"> | ||
| <img src="${imgUrl}" alt=${name}"></div> | ||
| <div class="pokemon-item-name"> | ||
| <p class="pokemon-name" id="pokemon-${id}"> #${id} ${name}</p> | ||
| </div> | ||
| </div>`; //plantilla de cadena de texto// | ||
|
|
||
| return HTML; | ||
| } | ||
|
|
||
| function addPokemonHTMLToMainContainer(HTML) { | ||
| document.getElementById('pokemon-listing').innerHTML = HTML; | ||
| } | ||
|
|
||
| function showAllPokemon() { | ||
| let pokemonHTML = ''; | ||
| data.pokemon.forEach((pokemonObj) => { | ||
| //console.log(pokemonObj); | ||
| //console.log(createPokemonItemHTML(pokemonObj)); | ||
| pokemonHTML += createPokemonItemHTML(pokemonObj); | ||
| }); | ||
|
|
||
| addPokemonHTMLToMainContainer(pokemonHTML); | ||
| } | ||
|
|
||
| function initial() { | ||
| //console.log(data.pokemon); | ||
| showAllPokemon(); | ||
| } | ||
|
|
||
| window.initial = initial; | ||
| initial(); | ||
|
|
||
|
|
||
| //funcion lista tipo pokemon | ||
|
|
||
| document.getElementById('typePokemon').addEventListener('change', (e) => { | ||
| const selectedIndex = e.currentTarget.selectedIndex; | ||
| if (selectedIndex === Ver) { | ||
| template(filterData(pokemon, 'All')); | ||
| } else if (selectedIndex === Agua) { | ||
| template(filterData(pokemon, 'Water')); | ||
| } else if (selectedIndex === Bicho) { | ||
| template(filterData(pokemon, 'Bug')); | ||
| } else if (selectedIndex === Dragón) { | ||
| template(filterData(pokemon, 'Dragon')); | ||
| } else if (selectedIndex === Eléctrico) { | ||
| template(filterData(pokemon, 'Electric')); | ||
| } else if (selectedIndex === Fantasma) { | ||
| template(filterData(pokemon, 'Ghost')); | ||
| } else if (selectedIndex === Fuego) { | ||
| template(filterData(pokemon, 'Fire')); | ||
| } else if (selectedIndex === Hielo) { | ||
| template(filterData(pokemon, 'Ice')); | ||
| } else if (selectedIndex === Lucha) { | ||
| template(filterData(pokemon, 'Fighting')); | ||
| } else if (selectedIndex === Normal) { | ||
| template(filterData(pokemon, 'Normal')); | ||
| } else if (selectedIndex === Hierva) { | ||
| template(filterData(pokemon, 'Grass')); | ||
| } else if (selectedIndex === Psíquico) { | ||
| template(filterData(pokemon, 'Psychic')); | ||
| } else if (selectedIndex === Roca) { | ||
| template(filterData(pokemon, 'Rock')); | ||
| } else if (selectedIndex === Tierra) { | ||
| template(filterData(pokemon, 'Ground')); | ||
| } else if (selectedIndex === Veneno) { | ||
| template(filterData(pokemon, 'Poison')); | ||
| } else if (selectedIndex === Volador) { | ||
| template(filterData(pokemon , 'Flying')); | ||
| } | ||
| }); |
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.
Excelente trabajo! Un comentario muy picky, hay que borrar los comentarios que no se utilicen.