diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/README.md b/README.md index a45b7d5..fd8a6cc 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,73 @@ -# Data Lovers +

+ +

## Índice -* [1. Preámbulo](#1-preámbulo) -* [2. Resumen del proyecto](#2-resumen-del-proyecto) -* [3. Objetivos de aprendizaje](#3-objetivos-de-aprendizaje) -* [4. Consideraciones generales](#4-consideraciones-generales) -* [5. Criterios de aceptación mínimos del proyecto](#5-criterios-de-aceptación-mínimos-del-proyecto) -* [6. Hacker edition](#6-hacker-edition) -* [7. Consideraciones técnicas](#7-consideraciones-técnicas) -* [8. Pistas, tips y lecturas complementarias](#8-pistas-tips-y-lecturas-complementarias) -* [9. Checklist](#9-checklist) +* [1. Introducción](#1-introducción) +* [2. PokeFanGO](#2-pokefango) +* [3. Historias de usuario](#3-historias-de-usuarios) +* [4. Prototipos de diseño](#4-prototipos-de-diseño) +* [5. Problemas detectados en test de usabilidad](#5-Problemas-detectados-en-test-de-usabilidad) +* [6. Objetivos de aprendizaje](#6-Objetivos-de-aprendizaje) +* [7. Checklist](#7-Checklist) *** -## 1. Preámbulo +## 1. Introducción -Según [Forbes](https://www.forbes.com/sites/bernardmarr/2018/05/21/how-much-data-do-we-create-every-day-the-mind-blowing-stats-everyone-should-read), -el 90% de la data que existe hoy ha sido creada durante los últimos dos años. -Cada día generamos 2.5 millones de terabytes de datos, una cifra sin -precedentes. +Pokémon GO es una experiencia de juego internacional que cuenta con más de mil millones de descargas y ha sido nombrada "el mejor juego para móviles" por Game Developers Choice Awards y "la mejor aplicación del año" por TechCrunch (tomado de Google Play). Los usuarios del juego se convierten en "Maestros/ entrenadores de Pokémon" y pueden: -No obstante, los datos por sí mismos son de poca utilidad. Para que esas -grandes cantidades de datos se conviertan en **información** fácil de leer para -los usuarios, necesitamos entender y procesar estos datos. Una manera simple de -hacerlo es creando _interfaces_ y _visualizaciones_. +* Descubrir el mundo Pokémon: explorar y descubrir nuevos Pokémon allá donde vayan. +* Atrapar distintos Pokémon para completar su Pokédex. +* Pelear contra Pokémon de otros entrenadores y conquistar un gimnasio. +* Competir en épicos combates contra otros entrenadores. +* Hacer equipo con otros entrenadores para atrapar poderosos Pokémon durante las incursiones. -En la siguiente imagen, podrás ver cómo con la data que que se ve en la parte -izquierda se puede construir una interfaz amigable y entendible por las -usuarias, al lado derecho. +![Bienvenidos](/src/img/imgMe.png) -![pokemon-data-to-ui](https://user-images.githubusercontent.com/12631491/218505816-c6d11758-9de4-428f-affb-2a56ea4d68c4.png) +## 2. PokeFanGO -## 2. Resumen del proyecto +PokeFanGO!! nació para todos los fans del popular juego PokémonGO, puede ser para jugadores experimentados y también para novatos. -En este proyecto **construirás una _página web_ para visualizar un -_conjunto (set) de datos_** que se adecúe a lo que descubras que tu usuario -necesita. +Para este proyecto, comenzamos por preguntar a varios jugadores pokémon sobre que esperaban encontrar, que información era útil o cómo realizaban sus búsquedas. -Como entregable final tendrás una página web que permita **visualizar la data, -filtrarla, ordenarla y hacer algún cálculo agregado**. Con cálculo agregado -nos referimos a distintos cálculos que puedes hacer con la data para mostrar -información aún más relevante para los usuarios (promedio, el valor máximo -o mínimo, etc). +De estas preguntas, concluímos que deseaban un Top, una lista completa de todos los pokemon, poder buscarlos por tipo, región, rareza, fuerza y por sus nombres; también, querían conocer en detalle a los pokemon (ataques, evoluciones, caramelos, tipos, rangos de fuerza y lore). -Esta vez te proponemos una serie de datos de diferentes _temáticas_ para que -explores y decidas con qué temática te interesa trabajar. Hemos elegido -específicamente estos sets de datos porque creemos que se adecúan bien a esta -etapa de tu aprendizaje. +Por lo que construímos 3 historias de usuario, con sus respectivos criterios de aceptación y definición de terminado. +Se espera que esta página pueda ayudarlos a conocer los pokémon para sacarle el mayor provecho al juego, y también pueda orientar a los jugadores novatos que apenas conocen a sus pokémon. -Una vez que definas tu área de interés, buscar entender quién es tu usuario -y qué necesita saber o ver exactamente; luego podrás construir la interfaz que -le ayude a interactuar y entender mejor esos datos. +El diseño visual fue inspirado de la página oficial de [PokémonGO](https://pokemongolive.com/) ,usamos tonos oscuros de azul y tonos claros de verde para el contraste, también se usó el mismo fondo para la pokedex y para acentuar algunos toques de color, usamos el tono amarillo de Pikachu. +Varios elementos en este proyecto fueron diseñados en Photoshop, como el título del proyecto, fondo del modal, botón de pokebola, etc. +La página es responsive para PC, tablet y celular. -Estos son datos que te proponemos: +![Vistas Responsive](/src/img/visual.jpg) -* [Pokémon](src/data/pokemon/pokemon.json): - En este set encontrarás una lista con los 251 Pokémon de la región de Kanto - y Johto, junto con sus respectivas estadísticas usadas en el juego - [Pokémon GO](http://pokemongolive.com). - - [Investigación con jugadores de Pokémon Go](src/data/pokemon/README.md) +También se agregó de manera adicional, un cuadro de estadísticas por tipo de pokemon, para que los usuarios puedan conocer que tipos de pokémon son más abundantes en el universo del juego. -* [League of Legends - Challenger leaderboard](src/data/lol/lol.json): - Este set de datos muestra la lista de campeones en una liga del - juego League of Legends (LoL). - - [Investigación con jugadores de LoL](src/data/lol/README.md) +Fue testeado al 100% de sus líneas, y probado con usuarios, para saber si habían errores o bug por corregir; también se consumió la data de JSON. -* [Rick and Morty](src/data/rickandmorty/rickandmorty.json). - Este set nos proporciona la lista de los personajes de la serie Rick and - Morty. [API Rick and Morty](https://rickandmortyapi.com). - - [Investigación con seguidores de Rick and Morty](src/data/rickandmorty/README.md) +## 3. Historias de usuarios -* [Juegos Olímpicos de Río de Janeiro](src/data/athletes/athletes.json). - Este set nos proporciona la lista de los atletas que ganaron medallas en las - olímpiadas de Río de Janeiro. - - [Investigación con interesados en juegos olímpicos de Río de Janeiro](src/data/athletes/README.md) +![HU1](/src/img/HU1.jpg) +![HU2](/src/img/HU2.jpg) +![HU3](/src/img/HU3.jpg) -* [Studio Ghibli](src/data/ghibli/ghibli.json). - En este set encontrarás una lista de las animaciones y sus personajes del - [Studio Ghibli](https://ghiblicollection.com/). - - [Investigación con seguidores de las animaciones del Studio Ghibli](src/data/ghibli/README.md) +## 4. Prototipos de diseño -* [Harry Potter](src/data/harrypotter/harry.json). - En este set encontrarás una lista de los personajes,libros pociones - y hechizos de toda la saga de - [Harry Potter](https://harrypotter.fandom.com). - - [Investigación con seguidoras de Harry Potter](src/data/harrypotter/README.md) +Prototipo de baja fidelidad: +![prototipo](/src/img/prototipo.jpg) -El objetivo principal de este proyecto es que aprendas a diseñar y construir una -interfaz web donde se pueda visualizar y manipular data, entendiendo lo que el -usuario necesita. +Prototipo de alta fidelidad: https://scene.zeplin.io/project/6421b04ed5549922e109d3e6 -## 3. Objetivos de aprendizaje +## 5. Problemas detectados en test de usabilidad -Reflexiona y luego marca los objetivos que has llegado a entender y aplicar en tu proyecto. Piensa en eso al decidir tu estrategia de trabajo. +* El primer diseño visual de la HU1, recibió críticas por los múltiples elementos '.gif', provocando "ruido visual". Lo solucionamos cambiando la imagen de fondo y reduciendo los elementos a los necesarios. +* El primer top fue de probabilidad de apariciones, lo cual no fue impactante para los usuarios, nos pidieron cambiarlo a un top mas interesante, de fuerza, porque según afirmaron: "Siempre nos topamos con esos pokemon en cada esquina, no hay nada interesante en ello". Lo solucionamos cambiando el top con los pokemon más fuertes. +* En la ventana de pokedex, nos informaron de un problema con los filtros, "¿Qué pasa si quiero reiniciar mi búsqueda?, ¿Tengo que regresar las opciones por defecto?", aunque se podría solucionar refrescando la página, nos aseguramos agregando un botón que limpie los filtros. +* Nos informaron de unos bugs en la ventanas modal de algunos pokémon, no mostraba la data completa. Lo solucionamos limitando el filtro de la data a pokemon que sobrepasaban del n°251, lo cual originaba el error. + +## 6. Objetivos de aprendizaje ### HTML @@ -286,338 +260,23 @@ Reflexiona y luego marca los objetivos que has llegado a entender y aplicar en t * [Pruebas con Usuarios 1 — ¿Qué, cuándo y para qué testeamos?](https://eugeniacasabona.medium.com/pruebas-con-usuarios-1-qu%C3%A9-cu%C3%A1ndo-y-para-qu%C3%A9-testeamos-7c3a89b4b5e7)

-## 4. Consideraciones generales - -* Este proyecto se debe resolver en duplas. -* El rango de tiempo estimado para completar el proyecto es de 3 a 4 Sprints. -* El proyecto será entregado subiendo tu código a GitHub (commit/push) y la - interfaz será desplegada usando [GitHub Pages](https://pages.github.com/). - -## 5. Criterios de aceptación mínimos del proyecto - -Los criterios para considerar que has completado este proyecto son: - -### Definición del producto - -Documenta brevemente tu trabajo en el archivo `README.md` de tu repositorio, -contándonos cómo fue tu proceso de diseño y cómo crees que el producto resuelve -el problema (o problemas) que tiene tu usuario. - -### Historias de usuario - -Una vez que entiendas las necesidades de tus usuarios, escribe las [Historias -de Usuario](https://es.wikipedia.org/wiki/Historias_de_usuario) que representen -todo lo que el usuario necesita hacer/ver. Las **Historias de Usuario** deben -ser el resultado de tu proceso de investigación o _research_ de tus usuarios. - -Asegúrate de incluir la definición de terminado (_definition of done_) y los -Criterios de Aceptación para cada una. - -En la medida de lo posible, termina una historia de usuario antes de pasar -a la siguiente (Cumple con Definición de Terminado + Criterios de Aceptación). - -### Diseño de la Interfaz de Usuario - -#### Prototipo de baja fidelidad - -Durante tu trabajo deberás haber hecho e iterado bocetos (_sketches_) de tu -solución usando papel y lápiz. Te recomendamos tomar fotos de todas las -iteraciones que hagas, que las subas a tu repositorio y las menciones en tu -`README.md`. - -#### Prototipo de alta fidelidad - -Lo siguiente es diseñar tu Interfaz de Usuario (UI por sus siglas en inglés - -_User Interface_). Para eso debes aprender a utilizar alguna herramienta de -diseño visual. Nosotros te recomendamos [Figma](https://www.figma.com/) que es -una herramienta que funciona en el navegador y, además, puedes crear una cuenta -gratis. Sin embargo, eres libre de utilizar otros editores gráficos como -Illustrator, Photoshop, PowerPoint, Keynote, etc. - -El diseño debe representar el _ideal_ de tu solución. Digamos que es lo que -desearías implementar si tuvieras tiempo ilimitado para trabajar. Además, tu -diseño debe seguir los fundamentos de _visual design_. - -#### Testeos de usabilidad - -Durante el reto deberás hacer _tests_ de usabilidad con distintos usuarios, y -en base a los resultados, deberás iterar tus diseños. Cuéntanos -qué problemas de usabilidad detectaste a través de los _tests_ y cómo los -mejoraste en tu propuesta final. - -### Implementación de la Interfaz de Usuario (HTML/CSS/JS) - -Luego de diseñar tu interfaz de usuario deberás trabajar en su implementación. -**No** es necesario que construyas la interfaz exactamente como la diseñaste. -Tu tiempo de hacking es escaso, así que deberás priorizar - -Como mínimo, tu implementación debe: - -1. Mostrar la data en una interfaz: puede ser un card, una tabla, una lista, - etc. -2. Permitir al usuario interactuar para obtener la infomación que necesita. -3. Ser _responsive_, es decir, debe visualizarse sin problemas desde distintos - tamaños de pantallas: móviles, tablets y desktops. -4. Que la interfaz siga los fundamentos de _visual design_. - -### Pruebas unitarias - -El _boilerplate_ de este proyecto no incluye Pruebas Unitarias (_tests_), así es -que tendrás que escribirlas tú para las funciones encargadas de _procesar_, -_filtrar_ y _ordenar_ la data, así como _calcular_ estadísticas. - -Tus _pruebas unitarias_ deben dar una cobertura del 70% de _statements_ -(_sentencias_), _functions_ (_funciones_), _lines_ (_líneas_), y _branches_ -(_ramas_) del archivo `src/data.js` que contenga tus funciones y está detallado -en la sección de [Consideraciones técnicas](#srcdatajs). - -## 6. Hacker edition - -Las secciones llamadas _Hacker Edition_ son **opcionales**. Si **terminaste** -con todo lo anterior y te queda tiempo, intenta completarlas. Así podrás -profundizar y/o ejercitar más sobre los objetivos de aprendizaje del proyecto. - -Features/características extra sugeridas: +## 7. Checklist -* En lugar de consumir la data estática brindada en este repositorio, puedes - consumir la data de forma dinámica, cargando un archivo JSON por medio de - `fetch`. La carpeta `src/data` contiene una versión `.js` y una `.json` de - de cada set datos. -* Agregarle a tu interfaz de usuario implementada visualizaciones gráficas. Para - ello te recomendamos explorar librerías de gráficas como - [Chart.js](https://www.chartjs.org/) - o [Google Charts](https://developers.google.com/chart/). -* 100% Coverage - -## 7. Consideraciones técnicas - -La lógica del proyecto debe estar implementada completamente en JavaScript -(ES6), HTML y CSS. En este proyecto NO está permitido usar librerías o -frameworks, solo [vanilla JavaScript](https://medium.com/laboratoria-how-to/vanillajs-vs-jquery-31e623bbd46e), -con la excepción de librerías para hacer gráficas (charts); ver -[_Parte opcional_](#6-hacker-edition) más arriba. - -El _boilerplate_ contiene una estructura de archivos como punto de partida así -como toda la configuración de dependencias: - -```text -. -├── EXTRA.md -├── README.md -├── package.json -├── src -| ├── data (según con qué data trabajes) -| | ├── lol -| | | ├── lol.js -| | | ├── lol.json -| | | └── README.md -| | ├── pokemon -| | | ├── pokemon.js -| | | ├── pokemon.json -| | | └── README.md -| | └── rickandmorty -| | | ├── rickandmorty.js -| | | ├── rickandmorty.json -| | | └── README.md -| | └── athletes -| | | ├── athletes.js -| | | ├── athletes.json -| | | └── README.md -| | └── ghibli -| | | ├── ghibli.js -| | | ├── ghibli.json -| | | └── README.md -| ├── data.js -| ├── index.html -| ├── main.js -| └── style.css -└── test - └── data.spec.js - -directory: 7 file: 20 -``` - -### `src/index.html` - -Como en el proyecto anterior, existe un archivo `index.html`. Como ya sabes, -acá va la página que se mostrará al usuario. También nos sirve para indicar -qué scripts se usarán y unir todo lo que hemos hecho. - -### `src/main.js` - -Recomendamos usar `src/main.js` para todo tu código que tenga que ver con -mostrar los datos en la pantalla. Con esto nos referimos básicamente a la -interacción con el DOM. Operaciones como creación de nodos, registro de -manejadores de eventos (_event listeners_ o _event handlers_), .... - -Esta no es la única forma de dividir tu código, puedes usar más archivos y -carpetas, siempre y cuando la estructura sea clara para tus compañeras. - -En este archivo encontrarás una serie de _imports_ _comentados_. Para _cargar_ -las diferentes fuentes de datos tendrás que _descomentar_ la línea -correspondiente. - -Por ejemplo, si "descomentamos" la siguiente línea: - -```js -// import data from './data/lol/lol.js'; -``` - -La línea quedaría así: - -```js -import data from './data/lol/lol.js'; -``` - -Y ahora tendríamos la variable `data` disponible en el script `src/main.js`. - -### `src/data.js` - -El corazón de este proyecto es la manipulación de datos a través de arreglos -y objetos. - -Te recomendamos que este archivo contenga toda la funcionalidad que corresponda -a obtener, procesar y manipular datos (tus funciones). Por ejemplo: - -* `filterData(data, condition)`: esta función `filter` o filtrar recibiría la - data, y nos retornaría aquellos datos que sí cumplan con la condición. - -* `sortData(data, sortBy, sortOrder)`: esta función `sort` u ordenar - recibe tres parámetros. - El primer parámetro, `data`, nos entrega los datos. - El segundo parámetro, `sortBy`, nos dice con respecto a cuál de los campos de - la data se quiere ordenar. - El tercer parámetro, `sortOrder`, indica si se quiere ordenar de manera - ascendente o descendente. - -* `computeStats(data)`: la función `compute` o calcular, nos permitirá hacer - cálculos estadísticos básicos para ser mostrados de acuerdo a la data - proporcionada. - -Estos nombres de funciones y de parámetros son solamente referenciales, lo que -decidas depende de tu propia implementación. - -Estas funciones deben ser [_puras_](https://medium.com/laboratoria-developers/introducci%C3%B3n-a-la-programaci%C3%B3n-funcional-en-javascript-parte-2-funciones-puras-b99e08c2895d) -e independientes del DOM. Estas funciones serán después usadas desde el archivo -`src/main.js`, al cargar la página, y cada vez que el usuario interactúe (click, -filtrado, ordenado, ...). - -### `src/data` - -En esta carpeta están los datos de las diferentes fuentes. Encontrarás una -carpeta por cada fuente, y dentro de cada carpeta dos archivos: uno con la -extensión `.js` y otro `.json`. Ambos archivos contienen la misma data; la -diferencia es que el `.js` lo usaremos a través de una etiqueta ` + + diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..3ac5c0d --- /dev/null +++ b/src/index.js @@ -0,0 +1,15 @@ +import { top10 } from './data.js'; +import dataPkmn from './data/pokemon/pokemon.js'; + +const arrPkmn = dataPkmn.pokemon; +const top10Pkmn = top10(arrPkmn); + +//Pokemon en Top 10 +for (let i=0 ; i res.json()) + .then((data) => { + const arrPkmn = data.pokemon + //console.log(arrPkmn.length); + //LISTAR POKEMON + const template = document.querySelector('.template1'); + const dataList = document.querySelector('.dataList'); + function pintar(datosAPintar){ + dataList.innerHTML=''; + for (let i=0; i1){ + dataListClone.querySelector('.container-type1').setAttribute("class", `container-type1 ${datosAPintar[i].type[0]}`); + dataListClone.querySelector('.container-type2').setAttribute("class", datosAPintar[i].type[1]); + }else{ + dataListClone.querySelector('.container-type1').setAttribute("class", datosAPintar[i].type[0]); + } + dataList.appendChild(dataListClone); + } + //ABRIR VENTANA MODAL + const containers = document.querySelectorAll('.container') + const modal = document.getElementById('modal') + containers.forEach(container => { + container.addEventListener('click', (e) =>{ + modal.style.display = "block"; + const idPkm=e.target.parentNode.classList[2]; + //buscar(idPkm, arrPkmn); + const resultadoArr = buscar(idPkm, arrPkmn) + //console.log(resultadoArr[0].name); + //datos en modal-region + const modalRegion = document.querySelector('.modal-region'); + const reg = resultadoArr[0].generation.name + if(reg === 'kanto'){ + modalRegion.setAttribute('src', 'img/kanto.png'); + }else{ + modalRegion.setAttribute('src', 'img/johto.png'); + } + //datos en modal-number + const modalNum = document.querySelector('.modal-num'); + modalNum.innerHTML = `N° ${resultadoArr[0].num}`; + //datos en modal-name + const modalName = document.querySelector('.modal-name'); + modalName.innerHTML = resultadoArr[0].name.toUpperCase(); + //datos en modal-about + const modalAbout = document.querySelector('.modal-about'); + modalAbout.innerHTML = resultadoArr[0].about; + //datos en modal-weight + const modalWeight = document.querySelector('.modal-weight'); + modalWeight.innerHTML = `PESO: ${resultadoArr[0].size.weight}
ALTURA: ${resultadoArr[0].size.height}`; + //datos en modal-encounter + const modalEncounter = document.querySelector('.modal-encounter'); + modalEncounter.innerHTML = ``; + //datos en modal-spawn + const modalSpawn = document.querySelector('.modal-spawn'); + modalSpawn.innerHTML = `PROB. APARICIÓN: ${resultadoArr[0]['spawn-chance']}`; + //datos en modal-table-atack + const modalTableAttack = document.querySelector('.modal-table-attack'); + modalTableAttack.innerHTML =` + + ◓◓◓ + MOV. RÁPIDO + ATAQ. ESPECIAL + + + NOMBRE + ${resultadoArr[0]['quick-move'][0].name} + ${resultadoArr[0]['special-attack'][0].name} + + + TIPO + ${resultadoArr[0]['quick-move'][0].type} + ${resultadoArr[0]['special-attack'][0].type} + + + B.DAÑO + ${resultadoArr[0]['quick-move'][0]['base-damage']} + ${resultadoArr[0]['special-attack'][0]['base-damage']} + + + ENERGÍA + ${resultadoArr[0]['quick-move'][0].energy} + ${resultadoArr[0]['special-attack'][0].energy} + + + TIEMPO + ${resultadoArr[0]['quick-move'][0]['move-duration-seg']} + ${resultadoArr[0]['special-attack'][0]['move-duration-seg']} + + ` + //datos en modal-rarity + const modalRarity = document.querySelector('.modal-rarity'); + const rare = resultadoArr[0]['pokemon-rarity']; + if(rare === 'normal'){ + modalRarity.setAttribute('src', 'img/pokebola_normal.gif'); + }else if(rare === 'mythic'){ + modalRarity.setAttribute('src', 'img/pokebola_mitico.gif'); + }else{ + modalRarity.setAttribute('src', 'img/pokebola_legendario.gif'); + } + //PRE EVOLUCIÓN Y EVOLUCIÓN + //OBTENER EL NÚMERO DE LA PREV Y NETX EVOLUTION + const datosPkm=resultadoArr[0].evolution; + let numPrevEv=0; + let numNextEv=0; + Object.entries(datosPkm).forEach(entry =>{ + const [key, value]=entry; + //console.log({key}); + if(key==='next-evolution'){ + const nextEv=value[0]; + Object.entries(nextEv).forEach(entry =>{ + const[key, value]=entry; + if (key==='num'){ + numNextEv=value; + if(+numNextEv>297){ + numNextEv=0; + } + //console.log(numNextEv); + } + }) + //console.log('TIENE EVOLUCION', nextEv) + }else if(key==='prev-evolution'){ + const nextPre=value[0]; + Object.entries(nextPre).forEach(entry =>{ + const[key, value]=entry; + if (key==='num'){ + numPrevEv=value; + if(+numPrevEv>297){ + + numPrevEv=0; + + } + //console.log(numPrevEv); + } + }) + //console.log('TIENE PRE EVOLUCION', nextPre) + } + }) + //OBTENER LA INFO DEL POKÉMON DE NEX Y PREV EVOLUTION + const modalPreEv = document.querySelector('.modal-evL'); + const modalNextEv = document.querySelector('.modal-evR'); + const nameEvL = document.querySelector('.modal-name-evL'); + const nameEvR = document.querySelector('.modal-name-evR'); + const modalCandy = document.querySelector('.modal-candy'); + nameEvL.innerHTML ='No tiene pre-evolución' + nameEvL.setAttribute('style', 'font-size:.6em') + nameEvR.innerHTML ='No tiene evolución'; + nameEvR.setAttribute('style', 'font-size:.6em'); + modalCandy.innerHTML =`caramelo del juego Pokemon GO No`; + modalPreEv.setAttribute('src',''); + modalNextEv.setAttribute('src',''); + if(numPrevEv!==0){ + const pkmPrevEv=buscar(numPrevEv, arrPkmn); + modalPreEv.setAttribute('src', pkmPrevEv[0].img); + // datos en modal-name izquierdo + if('prev-evolution' in resultadoArr[0].evolution){ + nameEvL.innerHTML = resultadoArr[0].evolution['prev-evolution'][0].name.toUpperCase(); + nameEvL.setAttribute('style', 'font-size:.7em') + } + } + if (numNextEv!==0){ + const pkmNextEv=buscar(numNextEv, arrPkmn); + modalNextEv.setAttribute('src', pkmNextEv[0].img); + //datos de nombre de next-evolution + if('next-evolution' in resultadoArr[0].evolution){ + nameEvR.innerHTML = resultadoArr[0].evolution["next-evolution"][0].name.toUpperCase(); + nameEvR.setAttribute('style', 'font-size:.7em'); + } + //datos en modal-candy + if('next-evolution' in resultadoArr[0].evolution){ + modalCandy.innerHTML = `caramelo del juego Pokemon GO ${resultadoArr[0].evolution["next-evolution"][0]['candy-cost']}`; + } + } + + //DATOS DE LA TABLA RESISTENCIA Y DEBILIDAD + const modalIconRes=document.querySelector('.modal-icon-res'); + const modalIconDeb=document.querySelector('.modal-icon-deb'); + modalIconDeb.innerHTML=''; + modalIconRes.innerHTML=''; + const titleRes=document.createElement('ul'); + const titleDeb=document.createElement('ul'); + titleRes.textContent='RESISTENCIA'; + titleDeb.textContent='DEBILIDAD'; + modalIconRes.appendChild(titleRes); + modalIconDeb.appendChild(titleDeb); + const resis=resultadoArr[0].resistant; + const deb=resultadoArr[0].weaknesses; + for(let i=0; i + ${resis[i].toUpperCase()}`; + titleRes.appendChild(li); + } + for(let i=0; i + ${deb[i].toUpperCase()}`; + titleDeb.appendChild(li); + } + //datos en modal-img + const modalImg = document.querySelector('.modal-img'); + modalImg.setAttribute("src", resultadoArr[0].img); + //datos en modal-name2 + const modalName2 = document.querySelector('.modal-name2'); + modalName2.innerHTML = resultadoArr[0].name.toUpperCase(); + //datos en modal-tipos + const modalType = document.querySelector('.modal-type'); + const typ = resultadoArr[0].type; + if(typ.length === 2){ + modalType.innerHTML='' + const newType1 = document.createElement('span'); + const newType2 = document.createElement('span'); + newType1.setAttribute('class', `${typ[0]}`); + newType2.setAttribute('class', `${typ[1]}`); + modalType.appendChild(newType1); + modalType.appendChild(newType2); + }else if(typ.length === 1){ + modalType.innerHTML='' + const newType = document.createElement('span'); + newType.setAttribute('class', `${typ[0]}`); + modalType.appendChild(newType); + } + //datos en modal-huevo + const modalEgg = document.querySelector('.modal-egg'); + const eggg = resultadoArr[0].egg; + if(eggg === 'not in eggs'){ + modalEgg.innerHTML = `huevo pokemon No`; + }else{ + modalEgg.innerHTML = `huevo pokemon ${eggg}`; + } + //datos en modal-table-power + const modalTablePower = document.querySelector('.modal-table-power'); + const att = resultadoArr[0].stats; + modalTablePower.innerHTML = ` + + POWER + + + + + ${att["base-attack"]} + + + + + ${att["base-defense"]} + + + + + ${att["base-stamina"]} + + + + + ${att["max-cp"]} + + + + + ${att["max-hp"]} + + ` + + + }) + }) + //CERRAR VENTANA MODAL + const close = document.querySelector('.close') + close.addEventListener('click',() =>{ + modal.style.display = "none"; + }) + } + pintar(arrPkmn); + //FILTRAR POR N°POKEDEX + const selectPokedex = document.getElementById('selectPokedex') + function changeOptionPokedex () { + const valor=selectPokedex.value; + if(valor===''){ + pintar(arrPkmn); + }else{ + const orden=filtrarOrden(valor, arrPkmn); + pintar(orden) + } + } + selectPokedex.addEventListener('change', changeOptionPokedex) + //FILTRAR POR REGION + const selectRegion = document.getElementById('selectRegion') + const changeOptionRegion = () => { + const optionRegion = selectRegion.options[selectRegion.selectedIndex].value; + if(optionRegion === 'kanto'){ + const dataKanto=filtrarRegion('kanto', arrPkmn); + pintar(dataKanto) + }else if(optionRegion === 'johto'){ + const dataJohto=filtrarRegion('johto', arrPkmn); + pintar(dataJohto) + }else if(optionRegion === ''){ + pintar(arrPkmn); + } + }; + selectRegion.addEventListener('change', changeOptionRegion) + //FILTRAR POR TIPO + const selectType=document.getElementById('selectType'); + const changeOptionType=()=>{ + const tipo=selectType.value; + if(tipo===''){ + pintar(arrPkmn); + }else { + const filterType=filtrarTipo(tipo, arrPkmn); + pintar(filterType); + } + } + selectType.addEventListener('change', changeOptionType) + //FILTRAR POR RAREZA + const selectRareza=document.getElementById('selectRareza'); + const changeOptionRareza=()=>{ + const rareza=selectRareza.value; + if(rareza===''){ + pintar(arrPkmn); + }else{ + const filterRareza=filtrarRareza(rareza, arrPkmn); + pintar(filterRareza); + } + } + selectRareza.addEventListener('change', changeOptionRareza); + //FILTRAR POR CP + const selectPC=document.getElementById('selectPC'); + const changeOptionCP=()=>{ + const cp=selectPC.value; + if(cp===''){ + pintar(arrPkmn); + }else{ + const filterCP=filtrarCp(cp, arrPkmn); + pintar(filterCP); + } + } + selectPC.addEventListener('change', changeOptionCP); + //BUSCAR POKÉMON + //Limitar caracteres en input + const busquedapkmn=document.getElementById('busquedapkmn'); + busquedapkmn.addEventListener('keydown', (e)=>{ + if((e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 65 || e.keyCode > 90) && e.keyCode !==8 && e.keyCode !==37 && e.keyCode !== 39 && e.keyCode !== 46) + e.preventDefault(); + }) + //buscar pokémon + const keyUp=document.getElementById('busquedapkmn') + keyUp.addEventListener('keyup', (e)=>{ + const inputBuscar=e.target.value.toLowerCase(); + const arrayBuscar= arrPkmn.filter(pokemon =>{ + const coincidencia=pokemon.name.match(inputBuscar); + if (coincidencia!==null){ + return true; + } + } ) + pintar(arrayBuscar); + }) + //boton reiniciar pokedex + const btn = document.querySelector('.lupa'); + btn.addEventListener('click', limpiar) + function limpiar(){ + window.location.reload(); + } + //boton estadística + const btnE = document.getElementById('btnE'); + const canvas = document.getElementById('canvas') + btnE.addEventListener('click', mostrar) + function mostrar(){ + canvas.style.display = 'block' + } + const close2 = document.querySelector('.close2') + close2.addEventListener('click',() =>{ + canvas.style.display = 'none'; + }) + //Estadísticas + const xValues = ['bug', 'dark', 'dragon', 'electric', 'fairy', 'fighting', 'fire', 'flying', 'ghost', 'grass', 'ground', 'ice', 'normal', 'poison', 'psychic', 'rock', 'steel', 'water']; + const yValues = [] + for(let i = 0; i + pkmn.type[0]===xValues[i] || pkmn.type[1]===xValues[i] + ) + const x = aaa.length + yValues.push(x) + } + const barColors = [ + "#8FD941", + "#5B6074", + "#327ECB", + "#FAD61F", + "#F9B1E5", + "#DE5466", + "#F78B28", + "#768cd0", + "#A28CE2", + "#38BD6E", + "#D3C893", + "#95FAFA", + "#C0C0BA", + "#F872E2", + "#FF8B7A", + "#C9B758", + "#2C9399", + "#4AB6F3" + ]; + + new Chart(document.getElementById('myChart'), { // eslint-disable-line + type: "doughnut", + data: { + labels: xValues, + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "ESTADÍSTICAS DE POKÉMON POR TIPO" + } + } + }); + }) + .catch((error) => { + console.error(error); // eslint-disable-line + }); \ No newline at end of file diff --git a/src/pokedex.html b/src/pokedex.html new file mode 100644 index 0000000..bd9ddd7 --- /dev/null +++ b/src/pokedex.html @@ -0,0 +1,165 @@ + + + + + PokeFanGO + + + + +
PokeFanGO y un pikachu saltandoINICIO
+
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+ + Buscar pokemon: +
+
+ +
+
+
+ +
+ + +
+
+ + + +
+ + + + + diff --git a/src/style.css b/src/style.css index e69de29..514306b 100644 --- a/src/style.css +++ b/src/style.css @@ -0,0 +1,1035 @@ +*{ + margin: 0; + padding: 0; +} +input[type="search"]::-webkit-search-decoration, +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-results-button, +input[type="search"]::-webkit-search-results-decoration { + display: none; +} +html, body{ + height: 100%; + width: 100%; + background-image: linear-gradient(rgba(10, 9, 9, 0.4), rgba(253, 252, 252, 0.4)), url(img/fondo.jpg); + background-size: 100% 100%; + background-attachment: fixed; + +} +body header{ + background-color: rgba(30, 53, 79, 1); + position: absolute; + width: 100%; + height: 13%; + left: 0px; + right: 0px; + top: 0px; +} +body header img{ + margin-left: 2%; + margin-top: 1%; + width: 15%; +} +body header .jolteonRun{ + margin-left: 75%; + width: 4%; +} +main .enter{ + width: 35%; + height: auto; + cursor: pointer; + margin-bottom: -5%; +} +main .img-copa{ + width: 40%; + margin-top: 7%; +} +main .welcome{ + position: absolute; + border-radius: 30px; + background-color: rgba(30, 53, 79, 0.82); + width: 40%; + height: auto; + text-align: center; + padding: 2%; + margin-top: 12%; + margin-left: 10%; + font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; + font-size: 4.4vh; + box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.5); + color: white; +} +main .welcome .font-logo{ + color: rgba(251, 215, 31, 1); +} +main .welcome .btn{ + background-color: transparent; + border: none; +} +main .table-top{ + position: absolute; + border-radius: 30px; + background-color: rgba(30, 53, 79, 0.82); + text-align: center; + width: 20%; + height:fit-content; + padding-top: 1.5%; + padding-bottom: 2%; + margin-left: 70%; + margin-top: 10%; + box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.5); + color: white; +} +main td img{ + width: 33%; + height: 33%; + height: auto; + margin: -2%; +} +main .img-colum{ + text-align: center; +} +main .top10, .tittle-top{ + text-align: left; + padding: .7%; + margin: 0; + font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; + font-size: 2.1vh; +} +.tittle-top{ + color: rgba(251, 215, 31, 1); +} +main th{ + font-size: .8em; +} +main .table-top .tb1{ + border-collapse: collapse; + width: 85%; + height: 30%; + margin-left: auto; + margin-right: auto; +} +main td { + width: 150px; + font-size: 2vh; +} +main .tr-hover:hover{ + color:rgba(30, 53, 79, 1); + background-color: rgb(255, 255, 255); + transform: scale(1.3); +} +footer{ + background-color: rgba(64, 121, 153, 1); + border-color: black; + position: absolute; + margin-bottom: 0%; + width: 100%; + height: 5%; + left: 0%; + bottom: 0%; + padding-top: .5%; + text-align: center; + font-family:system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif ; + font-size: 1em; + color: rgb(206, 205, 205); + border-top: 4px solid rgba(60, 214, 131, 1); +} +footer a{ + color: inherit; +} +/* max-height: 100%; */ +/* overflow: auto; */ +/* main .table-top::-webkit-scrollbar { + -webkit-appearance: none; +} +main .table-top::-webkit-scrollbar:vertical { + width: 10px; +} */ +.fondoPokedex { + background-image: url(img/fondo-pokedex.jpg); + height: 100%; + width: 100%; + background-size: 100% 100%; + background-attachment: fixed; +} +header .inicio { + font-family:sans-serif, Geneva, Tahoma, sans-serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, 'Times New Roman', Times, serif, Cochin, Georgia, Times, 'Times New Roman', serif, 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif, Times, serif, Tahoma, Geneva, Verdana, sans-serif, 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif, 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, 'Arial Narrow', Arial, sans-serif, Courier, monospace ; + font-size: 2.5vh; + color: white; + margin-left: 73%; + text-decoration: none; + border-radius: 20px; + background-image: linear-gradient(180deg, #1E354F 46.17%, #3D5775 100%); + padding: 1% 2%; + margin-top: 1%; + position: absolute; + width: 3.8%; + height: 20%; + left: 15%; + top: 7%; +} +header .inicio:hover { + box-shadow: 0px 3px 2px #FBD71F; +} +.main-pokedex{ + display: inline-flex; + height: 75%; + margin-top: 7%; + width: 99.5%; +} +.main-pokedex .filter{ + height: 100%; + width: 20%; +} +.main-pokedex .filter .filter-container{ + margin: 3%; + height: 19%; +} +.filter-containerChild { + display: inline-block; + width: 90%; + height: 40%; +} +.filter-containerChild label { + padding: 3% 8% 3% 30%; + display: block; + border-radius: 0px 15px 15px 0px; + background-color: #70DBA1; + font-size: 2.5vh; + text-align: right; + letter-spacing: .2em; + font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + border: 1px solid black; +} +.filter-select { + display: block; + margin-top: -9%; + height: 100%; + width: 90%; + max-height: 100%; + text-align: center; + padding: 1%; + cursor: pointer; + font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} +.filter-select:hover{ + background-color: #bad2ed; +} +.main-pokedex .listado{ + width: 80%; + display: block; +} +.listado .buscador{ + font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif ; + color:#1E354F; + padding: 1% 0 1% 5%; +} +.listado .buscador .buscador-input{ + border-radius: 7px; + padding: .3em 1em; + border-color: #9d9b9b; +} +.listado .buscador .lupa{ + padding: .5em; + border-radius: 7px; + background-color: #70DBA1; + border-color: #70DBA1; + margin-right: 45%; + font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +} +.listado .listado-pkmn{ + overflow: auto; + max-height: 90%; +} +.listado .listado-pkmn::-webkit-scrollbar{ + width: 25px; +} +.listado .listado-pkmn::-webkit-scrollbar-track{ + background: #3d577559; + border-radius: 30px; +} +.listado .listado-pkmn::-webkit-scrollbar-thumb{ + background-color: #1E354F; + border-radius: 30px; +} +.listado .listado-pkmn .dataList{ + display: flex; + flex-wrap: wrap; + align-content: center; + gap: 10%; + justify-content: center; + text-align: center; + font-family: Verdana, Geneva, Tahoma, sans-serif, Cochin, Georgia, Times, 'Times New Roman', serif; +} +.listado .listado-pkmn .dataList .container{ + margin: 2% 1% 2% 1%; +} +.listado .listado-pkmn .dataList .container:hover{ + transform: scale(1.2); +} +.container-dex{ + text-align: left; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif, Times, serif; + font-size: .8em; + font-weight: bold; +} +.container-type1{ + padding-right: .5em; +} +.container-type2{ + padding-left: .5em; +} +.grass::before{ + background-color: #38BD6E; + content: "Planta"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.poison::before{ + background-color: #F872E2; + content: "Veneno"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.water::before{ + background-color: #4AB6F3; + content: "Agua"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.electric::before{ + background-color: #FAD61F; + content: "Eléctrico"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.fighting::before{ + background-color: #DE5466; + content: "Lucha"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.fairy::before{ + background-color: #F9B1E5; + content: "Hada"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.fire::before{ + background-color: #F78B28; + content: "Fuego"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.ice::before{ + background-color: #95FAFA; + content: "Hielo"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.flying::before{ + background-color: #768cd0; + content: "Volador"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.psychic::before{ + background-color: #FF8B7A; + content: "Psíquico"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.normal::before{ + background-color: #C0C0BA; + content: "Normal"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.steel::before{ + background-color: #2C9399; + content: "Acero"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.bug::before{ + background-color: #8FD941; + content: "Bicho"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.dragon::before{ + background-color: #327ECB; + content: "Dragon"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.dark::before{ + background-color: rgba(91, 96, 116, 0.75); + content: "Siniestro"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.ground::before{ + background-color: #D3C893; + content: "Tierra"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.rock::before{ + background-color: #C9B758; + content: "Roca"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +.ghost::before{ + background-color: #A28CE2; + content: "Fantasma"; + padding: 0 .5em; + border-radius: 8px; + font-size: .9em; +} +#modal, #trModal, #canvas{ + background-color: #00000059; + display: none; + position: fixed; + z-index: 1; + width: 100%; + height: 100%; +} +.modal-content{ + background-image: url(img/fondo2.jpg); + background-size: contain; + background-repeat: no-repeat; + margin: auto; + margin-top: 2%; + padding: 1%; + width: 100vh; + height: 80vh; + display: flex; +} +.modal-left{ + width: 25%; + height: 80%; + display: block; +} +.modal-region{ + width: 60%; + display: block; +} +.modal-num{ + width: 100%; + display: block; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, 'Arial Narrow', Arial, sans-serif, Courier, monospace; + font-size: 2.5vh; + margin-top: 5%; +} +.modal-name{ + display: block; + font-weight: bold; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif, Helvetica, sans-serif, Geneva, Tahoma, sans-serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, 'Times New Roman', Times, serif, 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif, 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, 'Arial Narrow', Arial, sans-serif, 'Arial Narrow', Arial, sans-serif; + font-size: 2.8vh; + margin-top: 4%; +} +.modal-info{ + font-family: Arial, Helvetica, sans-serif, Times, serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, Geneva, Tahoma, sans-serif, 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, 'Arial Narrow', Arial, sans-serif; + font-size: 1.5vh; + width: 83%; + display: block; + margin-top: 5%; +} +.modal-about{ + padding-right: 3%; + margin-top: 2%; + display: block; + margin-bottom: 10%; +} +.modal-encounter li{ + margin-left: 9%; +} +.modal-spawn{ + margin-bottom: 15%; +} +.modal-table-attack{ + background-color: #00000015; + margin-top: 5%; + font-family: monospace, Cochin, Georgia, Times, 'Times New Roman', serif, Tahoma, Geneva, Verdana, sans-serif, 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif, Cochin, Georgia, Times, 'Times New Roman', serif, 'Times New Roman', Times, serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, Times, serif, 'Arial Narrow', Arial, sans-serif; + font-size: 2vh; +} +.modal-table-attack th:nth-child(2){ + + background-color: #59c182; + text-align: center; +} +.modal-table-attack th:nth-child(3){ + + background-color: #56a9d3; + text-align: center; +} +.modal-table-attack td{ + font-size: 1.2vh; + background-color: rgb(255, 252, 252); + text-align: center; +} +.modal-table-attack td:nth-child(2){ + background-color: #afe3c4; +} +.modal-table-attack td:nth-child(3){ + background-color: #afddf4; +} +.modal-rigth{ + height: 80%; + width: 80%; +} +.modal-rigth-top{ + /* border: 3px solid #e625ac; */ + display: inline-block; + width: 100%; + display: flex; +} +.modal-rarity{ + width: 25%; + margin-top: -3%; + margin-left: -5%; +} +.close{ + background-color: #00000038; + margin-left: 72%; + padding: 1% 3%; + border-radius: 15px; + height: 50%; + border: inherit; + font-weight: bold; + cursor: pointer; +} +.modal-rigth-center{ + /* border: 3px solid #e625ac; */ + width: 100%; + height: 25%; + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 30%; +} +.modal-evL{ + width: 20%; +} +.modal-evR{ + width: 20%; + margin-left: 5%; +} +.modal-rigth-bottom{ + /* border: 3px solid #e625ac; */ + display: flex; + height: 59%; +} +.modal-rb-L{ + display: block; + width: 27%; + padding-left: 7%; + padding-top: 2.5%; +} +.modal-name-evL{ + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + width: 83%; + float: right; + text-align: center; +} +.modal-icon{ + display: inline-flex; + border-radius: 10px; + text-align: center; + width: 80%; + font-family: monospace, Cochin, Georgia, Times, 'Times New Roman', serif, Tahoma, Geneva, Verdana, sans-serif, 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif, Cochin, Georgia, Times, 'Times New Roman', serif, 'Times New Roman', Times, serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, Times, serif, 'Arial Narrow', Arial, sans-serif; + font-size: 1.5vh; + padding: 5% 5%; + margin-top: 20%; + background: rgba(167, 163, 163, 0.38); +} +.modal-icon-res, .modal-icon-deb{ + width: 50%; +} +.modal-icon-res img, .modal-icon-deb img{ + width: 30%; + margin: 7% 25% -7%; +} +.modal-icon-res span, .modal-icon-deb span{ + font-size: 0.8em; +} +.modal-icon ul{ + list-style: none; + font-size: 0.8em; + display: block; +} +.modal-rb-C{ + display: block; + width: 35%; + height: 100%; +} +.modal-img{ + height: 60%; + margin-top: 12%; + max-width: 95%; + /* border: 3px solid #855bb1; */ +} +.modal-name2{ + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif, Helvetica, sans-serif, Geneva, Tahoma, sans-serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, 'Times New Roman', Times, serif, 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif, 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, 'Arial Narrow', Arial, sans-serif, 'Arial Narrow', Arial, sans-serif; + font-size: 2.3vh; + display: block; + text-align: center; + max-width: 88%; + margin-top: 8%; +} +.modal-type{ + font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + text-align: center; + width: 88%; + display: block; +} +.modal-egg{ + margin: auto; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + margin-top: 3%; + margin-right: 7%; + text-align: center; + display: inline-block; +} +.modal-egg img{ + width: 8%; + filter: drop-shadow(1px 2px 2px rgb(0, 0, 0)); +} +.modal-rb-R{ + width: 35%; + display: block; +} +.modal-name-evR{ + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + display: block; + margin-top: 10%; + text-align: center; + width: 57%; +} +.modal-candy{ + /* border: 3px solid #756378; */ + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + font-size: smaller; + margin-left: 14%; +} +.modal-candy img{ + width: 10%; + filter: drop-shadow(1px 2px 2px rgb(0, 0, 0)); + margin-top: 2%; + +} +.modal-table-power{ + background: rgba(167, 163, 163, 0.38); + border-radius: 15px; + padding: 3%; + margin-top: 15%; +} +.modal-table-power th{ + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif, Cochin, Georgia, Times, 'Times New Roman', serif, Geneva, Tahoma, sans-serif, 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, 'Arial Narrow', Arial, sans-serif; + letter-spacing: .5vh; + width: 100%; + padding-bottom: 2%; + text-align: center; +} +.modal-table-power td:first-child{ + width: 30% +} +.label-at, .td-at, .label-def, .label-stam, .label-max, .label-hp{ + font-size: 2vh; + font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif; + text-align: right; +} +progress[value]{ + appearance: none; + border: none; + width: 35%; + margin-bottom: -15%; +} +progress[value]::-webkit-progress-bar{ + background-color: #00000019; + border-radius: 15px; + width: 400%; + height: 50%; +} +progress[value]::-webkit-progress-value{ + border-radius: 15px; + background: linear-gradient(180deg, #3CD683 22.4%, #7CF4F0 100%); +} +#myChart{ + background-image: url(img/fondo-pokedex.jpg); + margin: auto; + margin-top: 2%; + padding: 1%; + width: 30%; + height: 55vh; + display: flex; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +} +.close2{ + height: 30px; + width: 30px; + background-color: #0000003b; + padding: 0; + border-radius: 20px; + position: fixed; + margin-top: -29.5%; + margin-left: 76%; + font-weight: bold; + border-style: none; + cursor: pointer; +} +#btnE{ + font-family:sans-serif, Geneva, Tahoma, sans-serif, Haettenschweiler, 'Arial Narrow Bold', sans-serif, 'Times New Roman', Times, serif, Cochin, Georgia, Times, 'Times New Roman', serif, 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif, Times, serif, Tahoma, Geneva, Verdana, sans-serif, 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif, 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, 'Arial Narrow', Arial, sans-serif, Courier, monospace ; + font-size: 2.5vh; + color: white; + border-radius: 20px; + background-image: linear-gradient(180deg, #1E354F 46.17%, #3D5775 100%); + padding: 1% 2% .8%; + border-style: none; + position: absolute; + margin-top: 1.5%; + right: 15%; +} +#btnE:hover { + box-shadow: 0px 3px 2px #FBD71F; +} + +@media only screen and (max-width: 420px) { + html, body{ + background-image: url(img/fondo-pokedex.jpg); + } + body header{ + height: 8%; + } + body header img{ + width: 50%; + } + body header .jolteonRun{ + display: none; + } + main{ + display: flex; + } + main .welcome{ + width: 90%; + background-color: rgba(255, 255, 255, 0); + margin: 20% 2% 0; + color:rgba(30, 53, 79, 1); + font-size: 3vh; + box-shadow:none; + } + main .welcome .font-logo{ + text-shadow: 3px 3px #1E354F; + } + main .table-top{ + background-color: rgb(30, 53, 79); + color:#ffffff; + width: 60%; + margin: 105% 5% 0 18%; + height: 43%; + } + .tittle-top{ + font-size: 1.7vh; + padding: 3%; + } + main td{ + font-size: 2.8vh; + padding-top: .5%; + } + footer{ + font-size: 1.6vh; + } + .fondoPokedex{ + height: 91%; + } + header .inicio{ + font-size: 1.8vh; + margin-left: 61%; + width: 14%; + height: 45%; + padding: 3% 2% 0% 4.7%; + margin-top: 2%; + } + .main-pokedex{ + margin-top: 20%; + width: 98%; + height: 84%; + display: flex; + flex-direction: column; + } + .main-pokedex .filter{ + width: 98%; + height: 35%; + display: inline-block; + margin-top: -4%; + } + .filter-containerChild{ + height: 100%; + width: 98%; + } + .filter-containerChild label{ + font-size: 1.5vh; + letter-spacing: .1em; + padding: 1% 5% 1% 0%; + display: block; + } + .filter-select{ + height: 70%; + margin-top: -11%; + margin-left: 1%; + max-width: 200px; + box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.5); + } + .filter-select option{ + font-size: 1vh; + } + .main-pokedex .listado{ + width: 100%; + height: 74%; + margin-top: 13%; + } + .listado .buscador .lupa{ + transform: scale(.8); + margin-left: -5%; + margin-right: 3%; + } + .listado .buscador .buscador-input{ + width: 32%; + } + #modal, #trModal{ + height: 85%; + width: 100%; + } + .modal-content{ + background-image: url(img/fondoCelular.jpg); + margin-left: 10%; + display: flex; + flex-direction: column; + } + .modal-left{ + width: 35%; + padding: 1%; + height: 45vh; + } + .modal-region{ + width: 18%; + position: fixed; + margin-left: 45%; + } + .modal-num{ + margin-top: 0; + font-size: 1.8vh; + } + .modal-name{ + margin-top: 0; + font-size: 2vh; + } + .modal-info{ + width: 100%; + margin-top: -2%; + font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, Times, serif, Helvetica, sans-serif; + } + .modal-about{ + margin-bottom: 1%; + } + .modal-weight{ + display: flex; + flex-wrap: wrap; + gap: 2% + } + .modal-encounter{ + width: 60%; + } + .modal-encounter li{ + width: 100%; + } + .modal-spawn{ + margin-bottom: 0; + width: 80%; + } + .modal-table-attack{ + margin-top: 0; + width: 75%; + position: fixed; + margin-top: -3%; + font-size: 1.3vh; + transform: scale(.8); + background-color: rgba(255, 255, 255, 0); + } + .modal-rigth{ + width: 36%; + } + .modal-rarity{ + margin-left: 5%; + transform: scale(1.5); + } + .close{ + margin-left: 56%; + transform: scale(1.5); + margin-top: -90%; + } + .modal-rigth-center{ + height: 18%; + margin-top: 17%; + gap: 40%; + } + .modal-rb-L{ + margin-left: -6%; + } + .modal-icon{ + margin-left: 5%; + margin-top: 25%; + width: 100%; + font-size: 1.05vh; + transform: scale(1.2); + } + .modal-icon-res span, .modal-icon-deb span{ + font-size: .8vh; + } + .modal-img{ + margin-top: -20%; + margin-left: 15%; + height: 40%; + } + .modal-name2{ + font-size: 1.7vh; + margin-top: 18%; + margin-left: 20%; + } + .modal-type{ + margin-left: 15%; + margin-top: 5%; + } + .modal-egg{ + margin-left: 35%; + } + .modal-name-evR{ + margin-left: 25%; + } + .modal-candy{ + margin-left: 38%; + } + .modal-table-power{ + transform: scale(.6); + margin-top: -5%; + } + #btnE{ + display: none; + } +} + +@media only screen and (min-width: 421px) and (max-width: 820px) { +.main-pokedex{ + margin-top: 10%; +} +main .welcome{ + font-size: 2vh; + margin-top: 50%; + margin-left: 7%; +} +main .table-top{ + font-size: 0.2vh; + margin-top: 13%; + width: 53%; + margin-left: 49%; + height: fit-content; + transform: scale(.7); +} +.tittle-top{ + font-size: 2vh; +} +.img-top{ + padding-left: -2%; +} +body header img{ + width: 35%; + padding-top: 1.5%; +} +body header{ + height: 11%; +} +body header .jolteonRun{ + width: 10%; + margin-top: -10%; +} +main .table-top .tb1 { + margin-left: -4%; + width: 110%; + +} +html, body{ + background-image: linear-gradient(rgba(10, 9, 9, 0.4), rgba(253, 252, 252, 0.4)), url(img/fondoTablet.jpg); +} +footer{ + font-size: 1.5vh; + padding-top: 2%; +} +.tb1 .img-copa{ + width: 70%; +} +header .inicio{ + margin-left: 62%; + margin-top: 4%; +} +.fondoPokedex{ + width: 100%; + margin-top: 8%; +} +.listado .buscador .lupa{ + margin-right: 15%; +} +.filter-containerChild label{ + font-size: 1.3vh; + padding-left: 3%; + letter-spacing: .1em; +} +.filter-select{ + height: 50%; +} +.filter-select option{ + font-size: 1.2vh; +} +.main-pokedex .listado{ + height: 118%; +} +header .inicio{ + font-size: 2.3vh; + margin-left: 61%; + width: 12%; + height: 45%; + padding: 3% 2% 0% 4.7%; + margin-top: 2%; + border-radius: 50px; +} +.modal-content{ + transform: scale(.6); + margin-left: -23%; +} +.fondoPokedex{ + height: 91%; +} +#btnE{ + display: none; +} +} + + diff --git a/test/data.spec.js b/test/data.spec.js index 09b1f23..3eea888 100644 --- a/test/data.spec.js +++ b/test/data.spec.js @@ -1,23 +1,492 @@ -import { example, anotherExample } from '../src/data.js'; +import { filtrarRegion, filtrarTipo, filtrarOrden, filtrarRareza, filtrarCp, buscar, top10} from '../src/data.js'; +const arrTest = [ + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + }, + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + }, + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + } +] -describe('example', () => { + +describe('filtrarRegion', () => { it('is a function', () => { - expect(typeof example).toBe('function'); + expect(typeof filtrarRegion).toBe('function'); }); - it('returns `example`', () => { - expect(example()).toBe('example'); + it('filtrarRegion, debería retornar los pokemon que sean de Kanto', () => { + expect(filtrarRegion('kanto', arrTest)).toStrictEqual([ + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + }, + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + } + ]); }); + it('filtrarRegion, debería retornar los pokemon que sean de Johto', () => { + expect(filtrarRegion('johto', arrTest)).toStrictEqual([{"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + }]) + }) }); -describe('anotherExample', () => { - it('is a function', () => { - expect(typeof anotherExample).toBe('function'); +describe('filtrarTipo', ()=>{ + it ('is a function', ()=>{ + expect(typeof filtrarTipo).toBe('function'); }); - it('returns `anotherExample`', () => { - expect(anotherExample()).toBe('OMG'); + it ('filtrarTipo, debería retornar los pokémos que sean de tipo flying', ()=>{ + expect(filtrarTipo('flying', arrTest)).toStrictEqual([ + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + } + ]) + }) +}); + +describe('filtrarRareza', ()=>{ + it ('is a function', ()=>{ + expect(typeof filtrarOrden).toBe('function'); }); + + it ('filtrarOrden, debería retornar los pokémon ordenados de forma descendente', ()=>{ + expect(filtrarOrden('mayor', arrTest)).toStrictEqual([ + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + }, + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + }, + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + } + ]) + }) + + it ('filtrarOrden, debería retornar los pokémon ordenados de forma ascendente', ()=>{ + expect(filtrarOrden('menor', arrTest)).toStrictEqual([ + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + }, + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + }, + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + } + ]) + }) }); + +describe('filtrarRareza', ()=>{ + it ('is a function', ()=>{ + expect(typeof filtrarRareza).toBe('function'); + }); + + it ('filtrarRareza, debería retornar los pokémon de rareza normal', ()=>{ + expect(filtrarRareza('normal', arrTest)).toStrictEqual([ + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + } + ]) + }), + it ('filtrarRareza, debería retornar los pokémon de rareza mythic', ()=>{ + expect(filtrarRareza('mythic', arrTest)).toStrictEqual([ + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + } + ]) + }), + it ('filtrarRareza, debería retornar los pokémon de rareza legendary', ()=>{ + expect(filtrarRareza('legendary', arrTest)).toStrictEqual([ + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + } + ]) + }) +}); + +describe('filtrarCp', () => { + it('is a function', () => { + expect(typeof filtrarCp).toBe('function'); + }); + it('filtrarCp, debería retornar el pokémon ordenado desde el más alto CP', () => { + expect(filtrarCp('maximo', arrTest)).toStrictEqual([ + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + }, + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + }, + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + } + ]); + }) + it('filtrarCp, debería retornar el pokémon ordenado desde el más bajo CP', () => { + expect(filtrarCp('minimo', arrTest)).toStrictEqual([ + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + }, + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + }, + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + } + ]); + }) +}) + +describe('top10', () => { + it('is a function', () => { + expect(typeof buscar).toBe('function'); + }); + it('buscar, debería retornar la información del pokémon celebi', () => { + expect(buscar('251', arrTest)).toStrictEqual([ + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + } + ]); + }) +}) + +describe('top10', () => { + it('is a function', () => { + expect(typeof top10).toBe('function'); + }); + it('top10, debería retornar los pokémon más fuertes', () => { + expect(top10(arrTest)).toStrictEqual([ + {"num": "251", + "name": "celebi", + "generation": { + "num": "generation ii", + "name": "johto" + }, + "pokemon-rarity": "mythic", + "type": [ + "psychic", + "grass" + ], + "stats": { + "max-cp": "3265" + } + }, + {"num": "144", + "name": "articuno", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "pokemon-rarity": "legendary", + "type": [ + "ice", + "flying" + ], + "stats": { + "max-cp": "3051" + } + }, + {"num": "001", + "name": "bulbasaur", + "generation": { + "num": "generation i", + "name": "kanto" + }, + "type": [ + "grass", + "poison" + ], + "pokemon-rarity": "normal", + "stats": { + "max-cp": "1115" + } + } + ]); + }) +}) + + +