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

pequeños cambios #18

Open
wants to merge 149 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
265997c
verificando las ramas
Jun 26, 2019
44c06d8
agregando prueba 2 para github
AdrySacbe Jun 26, 2019
3edea86
Merge pull request #1 from AdrySacbe/Adry
RosaIsela31 Jun 26, 2019
af414f8
solucionando conflictos
Jun 26, 2019
5ec77f7
Merge pull request #2 from RosaIsela31/Rosa
RosaIsela31 Jun 26, 2019
d0f39bc
subiendo la tercera prueba para github
Jun 26, 2019
5d6df87
tercera prueba github
Jun 26, 2019
1f4a25d
tercera prueba github
Jun 26, 2019
cdb07d1
tercera prueba github
Jun 26, 2019
93163b5
cuarta prueba github
Jun 26, 2019
5cafac0
quinta prueba github
Jun 26, 2019
fdf2ccb
Merge pull request #3 from RosaIsela31/Rosa
RosaIsela31 Jun 26, 2019
57aa20b
sexta prueba
AdrySacbe Jun 26, 2019
9ab177c
Merge pull request #4 from AdrySacbe/Adry
RosaIsela31 Jun 26, 2019
d6beb7b
Explicando como elegimos el tema para nuestro proyecto, en el README.md
Jun 28, 2019
182e597
agregando carpeta de imagenes
Jun 28, 2019
c227339
Update README.md
RosaIsela31 Jun 28, 2019
3d0a543
Update README.md
RosaIsela31 Jun 28, 2019
781e0e1
Merge pull request #5 from RosaIsela31/Rosa
RosaIsela31 Jun 28, 2019
07cc3a8
solucionando conflictos del readme.md
Jun 28, 2019
409d7c0
subiendo imagen de sketch dentro de la carpeta imagenes
Jun 28, 2019
3e80e64
agregando la imagen del sketch de baja afinidad en el readme.md
Jun 28, 2019
b4c65a0
agregando sketch de baja afinidad, modificando los errores
Jun 28, 2019
7a1fc1a
Modificando la estructura del README.md
Jun 28, 2019
3478da0
modificando errores de sintaxis en el README.md
Jun 28, 2019
aa666b8
Merge pull request #6 from RosaIsela31/Rosa
RosaIsela31 Jun 28, 2019
125ee18
agregando imagenes de las encuentas a la carpeta de imágenes
Jun 28, 2019
e4d5b44
agregando las imágenes de la encuenta en el README.md
Jun 28, 2019
1520d7a
Merge pull request #7 from RosaIsela31/Rosa
RosaIsela31 Jun 28, 2019
af2e3e6
agregué 2 center, en el primero tiene el botón que servirá para orden…
Jul 1, 2019
c9f73a1
Merge pull request #8 from RosaIsela31/Rosa
RosaIsela31 Jul 1, 2019
2572476
Agregue parrafos vacios y los mande a llamar en data.js para pintar l…
AdrySacbe Jul 1, 2019
8db2186
Merge pull request #9 from AdrySacbe/Adry
RosaIsela31 Jul 1, 2019
570edc3
Declaré más constantes en data.js, para pintar la data faltante de po…
Jul 1, 2019
ffac750
Merge pull request #10 from RosaIsela31/Rosa
RosaIsela31 Jul 1, 2019
3474d48
Cambié de nombre al botón firtsButton, ahora es 'adelante' y agregé o…
Jul 2, 2019
17a55b4
Merge pull request #11 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
25264d9
Modifiqué las caracteristicas que se visualizaban en pantalla de cada…
Jul 2, 2019
d2fb4c4
Merge pull request #12 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
70eda0a
Pequeños cambios
AdrySacbe Jul 2, 2019
eef8a29
Merge branch 'master' of https://github.com/RosaIsela31/MEX-Data-Love…
AdrySacbe Jul 2, 2019
3224612
Agregué funciones puras para avanzar y retroceder en la visualización…
Jul 2, 2019
39df599
Merge pull request #13 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
90000a2
Agregue el menu de hamburguesa para poder filtrar
AdrySacbe Jul 2, 2019
3eb1ff3
Agregue el Menu de Hamburguesa para poder despues filtrar
AdrySacbe Jul 2, 2019
b05b511
resolviendo problemas cpm github
AdrySacbe Jul 2, 2019
84d70b3
Merge branch 'master' of https://github.com/RosaIsela31/MEX-Data-Love…
AdrySacbe Jul 2, 2019
74207e4
ordenando todos los pokemones en columnas
Jul 2, 2019
bd3140e
Merge pull request #16 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
2c68cc1
Merge branch 'master' of https://github.com/RosaIsela31/MEX-Data-Love…
AdrySacbe Jul 2, 2019
3e38114
agregando imagen pikachu para que adry la edite
Jul 2, 2019
05e7d16
Merge pull request #17 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
6182120
Edite imagen Pokemon
AdrySacbe Jul 2, 2019
5d552c7
Merge pull request #15 from AdrySacbe/Adry
RosaIsela31 Jul 2, 2019
ab8d04f
Agregue menu de hamburguesa
AdrySacbe Jul 2, 2019
bc647cb
Merge pull request #18 from AdrySacbe/Adry
RosaIsela31 Jul 2, 2019
91c3761
recorté la imágen de pikachu
Jul 2, 2019
9390a26
resolviendo conflictos con la imágen
Jul 2, 2019
7876707
resolviendo conflictos con la imágen
Jul 2, 2019
1a54c9c
Merge pull request #19 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
9ee0c7d
Cambiando colores de seleccion
AdrySacbe Jul 2, 2019
7cc93c9
Merge pull request #20 from AdrySacbe/Adry
RosaIsela31 Jul 2, 2019
d2e71c9
agregando pequeños cambios a css en los li
Jul 2, 2019
93dbf19
Merge pull request #21 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
eb415c8
agregando cambios a css
Jul 2, 2019
f36f8cb
Merge pull request #22 from RosaIsela31/Rosa
RosaIsela31 Jul 2, 2019
2352cf5
agregé estilo a los botones 'siguiente' y 'atrás', eliminé algunas ca…
Jul 3, 2019
b9c7e66
Merge pull request #23 from RosaIsela31/Rosa
RosaIsela31 Jul 3, 2019
c0c2b3b
agregué más características a cada tarjeta de pokémon, y le agregué u…
Jul 3, 2019
43f8048
Merge pull request #24 from RosaIsela31/Rosa
RosaIsela31 Jul 3, 2019
67ec073
agregué estilo a la clase 'lista de pokemones' y una nueva sección co…
Jul 3, 2019
182a08c
Merge pull request #25 from RosaIsela31/Rosa
RosaIsela31 Jul 3, 2019
d2b17f0
agregué pequeñas modificaciones a la clase 'lista de pokemones'
Jul 3, 2019
a13f818
Merge pull request #26 from RosaIsela31/Rosa
RosaIsela31 Jul 3, 2019
25433b6
Cree menu mejorado para poder filtrar
AdrySacbe Jul 3, 2019
2b5baa0
Merge pull request #27 from AdrySacbe/Adry
RosaIsela31 Jul 3, 2019
d96b3bb
Arregle lo del hover y el menu para filtrar
AdrySacbe Jul 3, 2019
e6039aa
Merge pull request #28 from AdrySacbe/Adry
RosaIsela31 Jul 3, 2019
6ad098c
haciendo pequeños cambios
Jul 3, 2019
6ded8f1
cambiando todo el código de CSS
Jul 3, 2019
824f117
resolviendo conflictos
Jul 3, 2019
5ceb9bb
Merge pull request #29 from RosaIsela31/Rosa
RosaIsela31 Jul 3, 2019
51da027
Hover mejorado
AdrySacbe Jul 3, 2019
241a3a4
Merge pull request #30 from AdrySacbe/Adry
RosaIsela31 Jul 3, 2019
290f400
resolviendo conflictos github
Jul 3, 2019
03f7491
Merge branch 'master' into Rosa
RosaIsela31 Jul 3, 2019
c5eadb3
Merge pull request #31 from RosaIsela31/Rosa
RosaIsela31 Jul 3, 2019
80b2f9b
el código ya funciona de nuevo
Jul 3, 2019
1d49318
Merge pull request #32 from RosaIsela31/Rosa
RosaIsela31 Jul 3, 2019
d4f089f
Puse botones para filtrar pokemones
AdrySacbe Jul 5, 2019
abc4729
Merge pull request #33 from AdrySacbe/Adry
RosaIsela31 Jul 5, 2019
12b3552
agregando función que filtra por elemento y cambios en el estilo de l…
Jul 8, 2019
906464a
Merge pull request #34 from RosaIsela31/Rosa
RosaIsela31 Jul 8, 2019
4bb8833
agregué una barra de desplazamiento en la sección donde se muestran t…
Jul 8, 2019
f18e414
Merge pull request #36 from RosaIsela31/Rosa
RosaIsela31 Jul 8, 2019
a37ea3c
agregando responsive a la página
Jul 9, 2019
e7502d8
Merge pull request #37 from RosaIsela31/Rosa
RosaIsela31 Jul 9, 2019
29f003f
La página ya es responsive
Jul 9, 2019
7f5dc54
Merge pull request #38 from RosaIsela31/Rosa
RosaIsela31 Jul 9, 2019
6561bfc
agregando una nueva función que filtra por tipo de elemento, fue crea…
Jul 10, 2019
b7305fd
Merge pull request #39 from RosaIsela31/Rosa
RosaIsela31 Jul 10, 2019
cb96ebe
agregando función que ordena de la A-z
Jul 10, 2019
683b5d4
agregando función que ordena de Z-A y mas botones que filtran por tip…
Jul 10, 2019
abbd77f
Merge pull request #40 from RosaIsela31/Rosa
RosaIsela31 Jul 10, 2019
b23c11d
agregando plantilla grid en css
Jul 12, 2019
62266e9
Merge pull request #41 from RosaIsela31/Rosa
RosaIsela31 Jul 12, 2019
d4d816b
agregué row, col-, class container, t @media para que la página sea c…
Jul 14, 2019
8ceb4cc
Merge pull request #42 from RosaIsela31/Rosa
RosaIsela31 Jul 14, 2019
f5c3c8d
agregando responsive para todos los dispositivos
Jul 14, 2019
64a4442
Merge pull request #43 from RosaIsela31/Rosa
RosaIsela31 Jul 14, 2019
624e19e
agregando responsive para mobile s
Jul 14, 2019
ab447f5
Merge pull request #44 from RosaIsela31/Rosa
RosaIsela31 Jul 14, 2019
099d0d8
cambie el tamaño de la clase lista de pokemones y nav
Jul 14, 2019
38e126c
Merge pull request #45 from RosaIsela31/Rosa
RosaIsela31 Jul 14, 2019
1c66cc0
comenté todo el código y agregué los cambios de la rama Adry
Jul 14, 2019
4a6bc10
Merge pull request #46 from RosaIsela31/Rosa
RosaIsela31 Jul 14, 2019
5cfdfe8
depurando código del archivo main.js
Jul 14, 2019
a052628
Merge pull request #47 from RosaIsela31/Rosa
RosaIsela31 Jul 14, 2019
d30d083
depurando código de data.js
Jul 14, 2019
c7cd6a5
Merge pull request #48 from RosaIsela31/Rosa
RosaIsela31 Jul 14, 2019
cf7f29f
Comentando el código original de CSS, agregando el código de Adry par…
Jul 15, 2019
81cee61
Merge pull request #49 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
9e44102
Cambiando gif inicial
Jul 15, 2019
be85cb3
Merge pull request #50 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
fc4b45e
cambiando el estilo de la primera pantalla
Jul 15, 2019
e61da1e
Merge pull request #51 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
0c8c78b
cambiando color primera pantalla
Jul 15, 2019
20bf36a
Merge pull request #52 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
77bc63f
Cambiando estilo de los botones
Jul 15, 2019
f280bf9
agregando estilo a los containers
Jul 15, 2019
a51fc8d
Merge pull request #53 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
bc5d0be
cambiando imágen universe
Jul 15, 2019
4f0ddea
Le quité el border-radius a los li
Jul 15, 2019
7a360bf
Merge pull request #54 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
118c2be
cambiando primera imágen del readme
Jul 15, 2019
f40f5ee
Merge pull request #55 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
b590a83
modificando las direcciones de las imagenes del readme
Jul 15, 2019
f247a97
Merge pull request #56 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
569d39f
agregando ubicación de una imágen del readme
Jul 15, 2019
d918263
Merge pull request #57 from RosaIsela31/Rosa
RosaIsela31 Jul 15, 2019
05c62ed
separando funciones entre data y main
Aug 22, 2019
0ddfdd3
agregando funcion de fetch que aún no sirve
Aug 22, 2019
373b921
cambiando todo el estilo
Aug 23, 2019
3102bb4
renovando toda la interfaz
Aug 23, 2019
cc04ea2
Merge pull request #58 from RosaIsela31/Rosita-branch
RosaIsela31 Aug 23, 2019
b7ae5cc
agregando funciones de test
Aug 23, 2019
7843414
Merge pull request #59 from RosaIsela31/Rosita-branch
RosaIsela31 Aug 23, 2019
2c24b92
Cambiando el estilo del proyecto / colores
Oct 22, 2019
8a0b381
Merge pull request #60 from RosaIsela31/Rosita-branch
RosaIsela31 Oct 22, 2019
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
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified .eslintignore
100644 → 100755
Empty file.
Empty file modified .eslintrc
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified EXTRA.md
100644 → 100755
Empty file.
419 changes: 16 additions & 403 deletions README.md
100644 → 100755

Large diffs are not rendered by default.

Empty file modified collaboration.md
100644 → 100755
Empty file.
5,632 changes: 5,632 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

Empty file modified package.json
100644 → 100755
Empty file.
59 changes: 54 additions & 5 deletions src/data.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,57 @@
// esta es una función de ejemplo
// puedes ver como agregamos la función a nuestro objeto global window
//Esta función ordena los pokemones de A-Z
const sortData = (data) => {
data.sort((a, b) => {
let nameA = a.name.toUpperCase();
let nameB = b.name.toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
});
return data;
};

//----------------------------------------------------------------

//Esta función ordena los pokemones de Z-A
const sortDataZA = (data) => {
data.sort((a, b) => {
let nameA = a.name.toUpperCase();
let nameB = b.name.toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
});
return data.reverse();
};

window.sortData = sortData;
window.sortDataZA = sortDataZA;

//--------------------------------------------------------------
// Esta función se encarga del estadístico
const statisticsPercentage = (key, value, data) => {
let total = data.length;
let items = data.filter(element => element[key].indexOf(value) > -1);
let result = (items.length * 100) / total;
let trunc = Math.floor(result);
return trunc;
};

const example = () => {
return 'example';
//--------------------------------------------------------------
// Función que filtra por tipo de pokemon
const filterByType = (data) => {
const idTarget = event.target.id;
let items = data.filter(element => element.type[0] === idTarget || element.type[1] == idTarget || element.type[2] == idTarget);
return items;
};

window.example = example;
window.sortData = sortData;
window.sortDataZA = sortDataZA;
window.filterByType = filterByType;
window.statisticsPercentage = statisticsPercentage;
Empty file modified src/data/lol/lol.js
100644 → 100755
Empty file.
Empty file modified src/data/lol/lol.json
100644 → 100755
Empty file.
11 changes: 7 additions & 4 deletions src/data/pokemon/pokemon.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var POKEMON = {
window.POKEMON = {
"pokemon": [{
"id": 1,
"num": "001",
Expand All @@ -19,9 +19,9 @@ var POKEMON = {
"multipliers": [1.58],
"weaknesses": [
"Fire",
"Ice",
"Flying",
"Psychic"
" Ice",
" Flying ",
" Psychic "
],
"next_evolution": [{
"num": "002",
Expand Down Expand Up @@ -4085,3 +4085,6 @@ var POKEMON = {
}]
}
;;



Empty file modified src/data/pokemon/pokemon.json
100644 → 100755
Empty file.
Empty file modified src/data/rickandmorty/rickandmorty.js
100644 → 100755
Empty file.
Empty file modified src/data/rickandmorty/rickandmorty.json
100644 → 100755
Empty file.
Empty file modified src/data/steam/steam.js
100644 → 100755
Empty file.
Empty file modified src/data/steam/steam.json
100644 → 100755
Empty file.
Binary file added src/imagenes/SegundaEncuesta.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/balbasaur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/comoTeIndentificas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/loMasImportanteQueQuieresSaber.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/logologo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/logologo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/pikachuuu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/pokemon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/primeraEncuesta.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/queEdadTienes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/sketch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/teGustariaNuestraAplicacion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/universepokemon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/imagenes/wall.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 92 additions & 16 deletions src/index.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,18 +1,94 @@

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Data Lovers</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="root"></div>
<!-- <script src="./data/injuries/injuries.js"></script> -->
<!-- <script src="./data/pokemon/pokemon.js"></script> -->
<!-- <script src="./data/steam/steam.js"></script> -->
<!-- <script src="./data/worldbank/worldbank.js"></script> -->
<!-- <script src="./data/lol/lol.js"></script> -->
<script src="data.js"></script>
<script src="main.js"></script>
</body>
</html>
<head>
<link href="https://fonts.googleapis.com/css?family=Coiny&display=swap" rel="stylesheet">
<meta charset="utf-8">
<title>Data Lovers</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="container" >
<figure>
<img src="./imagenes/logologo.png" id="logologo" alt="">
</figure>
<div id="pokemones-unoxuno">
<div>
<h2 id="name">¡Para que comiences a conocer el universo Pokémon! <br> </h2><br>
<img id="img" height="250" width="250" src="./imagenes/pikachuuu.png"><br>
</div>

<div>
<button id="atras" class="button_unoxuno">Atrás</button>
<button id="siguiente" class="button_unoxuno">Siguiente</button>
</div><br>

<button id="conocertodos" class="btn_todos_pokemones">conocer a todos los pokemones</button>
</div>
</div>

<section id="estadistica" class="ocultar">
<p id="numerodepokemones"></p>
<p id="porcentajedepokemones"></p>
</section>
<section id="todospokemones" class="ocultar ">
<div id="nav">
<button class="enlace btnPok" type="button" id="Ice">Hielo</button>
<button class="enlace btnPok" type="button" id="Fire">Fuego</button>
<button class="enlace btnPok" type="button" id="Water">Agua</button>
<button class="enlace btnPok" type="button" id="Grass">Hierba</button>
<button class="enlace btnPok" type="button" id="Psychic">Psíquico</button>
<button class="enlace btnPok" type="button" id="Rock">Roca</button>
<button class="enlace btnPok" type="button" id="Electric">Eléctrico</button>
<button class="enlace btnPok" type="button" id="Bug">Insecto</button>
<button class="enlace btnPok" type="button" id="Flying">Volador</button>
<button class="enlace btnPok" id="enlace">Filtrar A-Z</button>
<button class="enlace btnPok" id="orderZ_A">Filtrar Z-A</button> <br>
</div>
<div id="mostrando_lista_pokemones"></div>
</section>
<!-- *************************************************************** -->

<!-- <input type="button" class="button" value="Pokemones" id="catalog">
<section id="characters-page" >
<div class="menu-second content">
<h2>Pokemones</h2>
<div class="order-and-filter-button">
<div class="pokemon-type order-filter">
<select name="filter" id="filter">
<option value="all">Mostrar todos</option>
<option value="ice">Ice</option>
<option value="fire">Fire</option>
<option value="water">Water</option>
<option value="grass">Grass</option>
<option value="psychic">Psychic</option>
<option value="dragon">Dragon</option>
<option value="rock">Rock</option>
<option value="electric">Electric</option>
<option value="ground">Ground</option>
<option value="poison">Poison</option>
<option value="flying">Flying</option>
</select>

<select name="order" id="order">
<option value="order" class="order">Ordenar</option>
<option value="a-z">de A a Z</option>
<option value="z-a">de Z a A</option>
</select>
</div>
</div>
</div>

<section class="all-data" id="all-data">
</section>
</section> -->
<!-- *************************************************************** -->

<script src="./data/pokemon/pokemon.js"></script>
<script src="main.js"></script>
<script src="data.js"></script>

</body>
</html>

148 changes: 148 additions & 0 deletions src/main.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
const data = window.POKEMON.pokemon;

//----------------------------------------------------------
// Consumiendo la API
// const consultarPokemon = (id) => {
// //funcion extraer data api
// fetch(`https://pokeapi.co/api/v2/pokemon/${id}`)
// .then(function(response){
// response.json()
// .then(function(pokemon){
// console.log(pokemon.name);
// })
// })
// }
// consultarPokemon();
//----------------------------------------------------------

//Seleccionando a los elementos del HTML con ayuda de su Id.
const firstButton = document.getElementById("siguiente");
const buttonAtras = document.getElementById("atras");
const name = document.getElementById("name");
const img = document.getElementById("img");
const container=document.getElementById("container");
const conocertodos = document.getElementById("conocertodos");
const todospokemones = document.getElementById("todospokemones");
let contador = 0;
//Estadístico
let numero=0;
const numerodepokemones=document.getElementById("numerodepokemones");
const porcentajedepokemones=document.getElementById("porcentajedepokemones");
const estadisticas=document.getElementById("estadistica");
// Buttons for pokemons type
const btnIce = document.getElementById("Ice");
const btnFire = document.getElementById("Fire");
const btnWater = document.getElementById("Water");
const btnGrass = document.getElementById("Grass");
const btnPsychic = document.getElementById("Psychic");
const btnRock = document.getElementById("Rock");
const btnElectric = document.getElementById("Electric");
const btnBug = document.getElementById("Bug");
const btnFlying = document.getElementById("Flying");

//-----------------------------------------------------------------------
// Función para mostrar a los pokemones de uno en uno
const showOnexOne = () => {
name.innerHTML = "nombre:" + " " + window.POKEMON.pokemon[contador].name;
img.src = window.POKEMON.pokemon[contador].img;
contador=contador+1;
};

// Función para retroceder en la visualización de los pokemones uno x uno
const showOnexOneReverse = () => {
name.innerHTML = "nombre:" + " " + window.POKEMON.pokemon[contador].name;
img.src = window.POKEMON.pokemon[contador].img;
contador=contador-1;
};
//-----------------------------------------------------------------------

// Función que imprime la data en section1
const imprimir = (data) => {
//llamar section donde se imprime la data
const mostrar = document.getElementById('mostrando_lista_pokemones');
mostrar.innerHTML = '';
let template='';
for(let pokemon of data){
//mostrar.innerHTML += `<ul><li>
template +=`<li>
<img src="${pokemon.img}">
<p><strong>Nombre:</strong> ${pokemon.name}</p>
<p><strong>Tipo:</strong>${pokemon.type}</p>
<p><strong>Candy:</strong>${pokemon.candy}</p>
</li> `;
}
mostrar.innerHTML=`<ul>${template}</ul>`;
numero=data.length;
numerodepokemones.innerHTML=`${numero} de 151 pokemones`;
porcentajedepokemones.innerHTML=`${numero/151*100}% de los pokemones`;
};
imprimir(data);

//----------------------------------------------------------------

//Función que ordena la data de A-Z
const btnAZ = document.getElementById("enlace");

const orderAZ = () => {
let result = window.sortData(data);
// newDataAZ = result;
imprimir(result);
};

btnAZ.addEventListener("click", orderAZ);

//----------------------------------------------------------------

//Función que ordena la data de Z-A
const btnZA = document.getElementById("orderZ_A");

const orderZA = () => {
let result = window.sortDataZA(data);
// newDataAZ = result;
imprimir(result);
};

btnZA.addEventListener("click", orderZA);

//----------------------------------------------------------
//Función que filtra por tipo, llama a la función pura filterByType
const filter = () => {
let result = window.filterByType(data);
imprimir(result);
};
//----------------------------------------------------------
//Función que muestra todos los pokemons y el estadistico
const mostrartodos = () => {
todospokemones.classList.remove("ocultar");
todospokemones.classList.add("lista_de_pokemones");
container.classList.add("ocultar");
estadisticas.classList.remove("ocultar");
};

//**************************************************
//PROBANDO CON EL SELECT
// let imSelection = document.getElementById("select-type");
// imSelection.addEventListener("click", () => {
// let imValue = imSelection.options[imSelection.selectedIndex].value;
// //console.log(typeof imValue);
// //console.log(imValue);
// let pokeFilterData = window.data.filterByType(data, imValue);
// imprimir(pokeFilterData);
// });

//----------------------------------------------------------
//Llamando a las funciones
firstButton.addEventListener("click", showOnexOne);
buttonAtras.addEventListener("click", showOnexOneReverse);
//Conocer a todos los pokemones
conocertodos.addEventListener("click",mostrartodos);
//Buttons for pokemon type
btnIce.addEventListener("click", filter);
btnFire.addEventListener("click", filter);
btnWater.addEventListener("click", filter);
btnGrass.addEventListener("click", filter);
btnPsychic.addEventListener("click", filter);
btnRock.addEventListener("click", filter);
btnElectric.addEventListener("click", filter);
btnBug.addEventListener("click", filter);
btnFlying.addEventListener("click", filter);
Loading