Skip to content
Open

Oh #41

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
78faeae
prueba1
maluigoumez Aug 3, 2023
b30dae1
prueba2
LorenaBarr Aug 3, 2023
7ee80a5
estrcutura html hasta section parte 1
LorenaBarr Aug 7, 2023
7392d5b
impor-expor de json
LorenaBarr Aug 8, 2023
d3ee9e4
imegenes y nombres de pokemon con el bucle for each
LorenaBarr Aug 8, 2023
53df67a
cambio de fuente
LorenaBarr Aug 10, 2023
840524e
cambios pokemon grid
maluigoumez Aug 10, 2023
11bb49f
se ubico los contenedores en flex, se alinean las cards
LorenaBarr Aug 10, 2023
01d212d
Funcion del filtrado, error
LorenaBarr Aug 14, 2023
8d92fea
funcion de filtrado por tipos de pokemon en data.js, llamado del Dom …
LorenaBarr Aug 14, 2023
484fd91
se agrego la funcionalidad del filtro, el input sugiere al usuario po…
LorenaBarr Aug 15, 2023
3ccbc8d
implementacion de prueba unitaria con la funcionalidad de filtrado, p…
LorenaBarr Aug 16, 2023
01c0899
se me habia borrado sin darme cuenta el codigo de la prueba
LorenaBarr Aug 16, 2023
fcd4d5f
Se agrego la funcion de limpiar filtro y organizo la carpeta main.js,…
LorenaBarr Aug 17, 2023
5eeb1ad
estilos de encabezados, fondo de body, container cambio de ubicacion …
LorenaBarr Aug 18, 2023
9934457
se agrego una datalist para el input donde se sugieren los nombres de…
LorenaBarr Aug 18, 2023
ff3e64a
se cambio la imagen del logo de pokemon go por formato svg, para quit…
LorenaBarr Aug 21, 2023
1bbda9b
resolucion de bug que duplicaba datos en el filtro
maluigoumez Aug 22, 2023
782be83
estrcutura html de dialog, referencias de elementos del dom del dialo…
LorenaBarr Aug 22, 2023
9e2bd1e
Se agrego un select con las formas de ordenado, falta funcionalidad
LorenaBarr Aug 22, 2023
08dce96
estructura del dialog, pero aun no tiene funcionalidad
LorenaBarr Aug 23, 2023
649dc3d
codigo para el dialog, pero aun no funciona
LorenaBarr Aug 24, 2023
8cc7ac2
funcionalidad de ordenado alfabéticamente y por numero de pokedex
maluigoumez Aug 24, 2023
2ca03cf
merge de filtro y dialog
maluigoumez Aug 24, 2023
c3900a5
probando console.log en las diferentes funciones para verificar los l…
LorenaBarr Aug 25, 2023
f5bf557
depurando para encontar el error, los llamdos de Dom con console.log …
LorenaBarr Aug 26, 2023
f5ccf56
se muestran los dialog, solucion de errores, frente a los evenlist, y…
LorenaBarr Aug 27, 2023
47b16c7
funciona el dialog en los diferentes filtros y orden
LorenaBarr Aug 28, 2023
d13004a
ordenado A-z, Z-a, num1-251, num251-1
maluigoumez Aug 29, 2023
36376e6
Merge pull request #1 from LorenaBarr/funcionalidad-de-ordenado
LorenaBarr Aug 29, 2023
7746d63
cambios en css
LorenaBarr Aug 30, 2023
b5b3c75
pruebas unitarias para funcion de ordenado, 2 passed, 2 failed
maluigoumez Aug 31, 2023
2b0beab
se agrego un color de fondo a cada dialog segun el tipo del pokemon
LorenaBarr Aug 31, 2023
749e307
Merge branch 'main' of https://github.com/LorenaBarr/DEV010-data-love…
LorenaBarr Aug 31, 2023
9dad068
cambio en el diseño de dialog
LorenaBarr Aug 31, 2023
20498a4
cambio de orden para funcion de ordenado
maluigoumez Aug 31, 2023
805be70
ajuste de pruebas unitarias, 4 passed, 2 failed, faltan pruebas para …
maluigoumez Aug 31, 2023
66f9467
css responsive con un max width 900px para moviles
LorenaBarr Sep 1, 2023
33118a6
ajuste de testing en oh
maluigoumez Sep 1, 2023
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 added .eslintrc.js
Empty file.
7,509 changes: 7,509 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"htmlhint": "htmlhint src/*.html test/*.html",
"eslint": "eslint --ext .js src/ test/",
"pretest": "npm run eslint && npm run htmlhint",
"xpretest": "npm run eslint && npm run htmlhint",
"test": "jest --verbose --coverage",
"open-coverage-report": "opener ./coverage/lcov-report/index.html",
"start": "serve src/",
Expand All @@ -19,7 +19,7 @@
"eslint": "^8.3.0",
"gh-pages": "^3.1.0",
"htmlhint": "^1.0.0",
"jest": "^27.0.1",
"jest": "^27.5.1",
"opener": "^1.5.1",
"serve": "^13.0.2"
},
Expand All @@ -31,4 +31,4 @@
"version": "6.4.0",
"commit": "4ea26447e1a259476f237a7a6212e3a02409910b"
}
}
}
Binary file added src/Fuente-pokemon/Pokemon Hollow.ttf
Binary file not shown.
Binary file added src/Fuente-pokemon/Pokemon Solid.ttf
Binary file not shown.
89 changes: 83 additions & 6 deletions src/data.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,86 @@
// estas funciones son de ejemplo
//filtrar, ordenar, calcular//
// Importar el módulo pokedex que contiene los datos de los Pokémon
import pokedex from "./data/pokemon/pokemon.js";

export const example = () => {
return 'example';
};
// Objeto que contiene funciones para filtrar, ordenar y calcular información sobre los Pokémon
// El código define un objeto llamado pokeData que contiene una función llamada filterByType
//para filtrar Pokémon por tipo. Si el tipo es vacío, la función devuelve todos los Pokémon.
//De lo contrario, filtra los Pokémon por el tipo especificado y devuelve los resultados.

const pokeData = {
// Función para filtrar Pokémon por tipo
filterByType: function (type, pokedex) {
if (type === "") {
return pokedex.pokemon;
// Si el tipo es vacío, devolver todos los Pokémon
} else {
// Filtrar los Pokémon por el tipo especificado
return pokedex.pokemon.filter((pokemon) => pokemon.type.includes(type));
}
},

// Función para obtener los nombres de todos los Pokémon
//*La función getPokemonNames mapea los datos de los Pokémon y devuelve un array
// con los nombres de todos los Pokémon. Utiliza el método map para recorrer cada
// objeto de la lista pokedex.pokemon y obtener el valor de la propiedad name.
// Luego, retorna un nuevo array con los nombres obtenidos.*//

getPokemonNames: function () {
// Mapear los datos de los Pokémon y obtener sus nombres
return pokedex.pokemon.map((pokemon) => pokemon.name);
},

// Función para obtener la información de un Pokémon por su nombre
getPokemonInfoByName: function (name) {
const lowerCaseName = name.toLowerCase();
const pokemonInfo = pokedex.pokemon.find(
(pokemon) => pokemon.name === lowerCaseName
);
return pokemonInfo || null; // Si no se encuentra el Pokémon, devuelve null
},

// Función para filtrar Pokémon por nombre
//La función filterByPokemonName recibe un parámetro name y
//filtra los Pokémon en base a su nombre. Utiliza el método filter para iterar sobre la lista de Pokémon
//y devuelve aquellos cuyo nombre coincida exactamente con el valor del parámetro name,
//sin importar si las letras están en mayúsculas o minúsculas.

filterByPokemonName: function (name, pokemons) {
return pokemons.pokemon.filter(
(pokemon) => pokemon.name.toLowerCase() === name
);
},

// //función para ordenar pokemones
// sortAscending: function (pokemons) {
// return pokemons.slice().sort();
// },
// Function to sort and render Pokémon based on the selected order

sortAscendingByNum: function (pokemonArray) {
const orderedList = pokemonArray.sort((a, b) => a.num - b.num);
return orderedList;
},

sortDescendingByNum: function (pokemonArray) {
const orderedList = pokemonArray.sort((a, b) => b.num - a.num);
return orderedList;
},

orderAndUpdateList: function (selectedOrder, data) {
let currentPokemon;
if (selectedOrder === "a-z") {
currentPokemon = data.sort((a, b) => a.name.localeCompare(b.name));
} else if (selectedOrder === "z-a") {
currentPokemon = data.sort((a, b) => b.name.localeCompare(a.name));
} else if (selectedOrder === "num1-251") {
currentPokemon = data = pokeData.sortAscendingByNum(data);
} else if (selectedOrder === "num251-1") {
currentPokemon = data = pokeData.sortDescendingByNum(data);
}

export const anotherExample = () => {
return 'OMG';
return currentPokemon;
},
};
// Exportar el objeto pokeData para su uso en otros archivos
export default pokeData;
93 changes: 91 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,100 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Data Lovers</title>
<meta charset="utf-8" />
<title>Data Lovers - Pokemon Go</title>
<link rel="stylesheet" href="style.css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Lato:wght@700&display=swap"
rel="stylesheet"
/>
</head>

<body>
<header>
<img
src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Pok%C3%A9mon_GO_logo.svg/2560px-Pok%C3%A9mon_GO_logo.svg.png"
alt="Pokemon GO logo"
id="logo"
/>
<h1>Everything you need to know to become the best Pokemon Master!</h1>
</header>
<div class="container">
<nav class="menu">
<ul>
<li class="search">
<input
type="text"
placeholder="Write the pokemon name"
list="pokemonNames"
/>
<datalist id="pokemonNames"></datalist>
<button>Search</button>
<div class="suggestions"></div>
</li>
</ul>
<select id="typeFilter">
<option value="">All Types</option>
<option value="grass">Grass</option>
<option value="fire">Fire</option>
<option value="normal">Normal</option>
<option value="water">Water</option>
<option value="flying">Flying</option>
<option value="fighting">Fighting</option>
<option value="electric">Electric</option>
<option value="ground">Ground</option>
<option value="psychic">Psychic</option>
<option value="ice">Ice</option>
<option value="bug">Bug</option>
<option value="ghost">Ghost</option>
<option value="steel">Steel</option>
<option value="dragon">Dragon</option>
<option value="dark">Dark</option>
<option value="fairy">Fairy</option>
<option value="poison">Poison</option>
</select>
<button id="filterButton">Filter</button>

<select id="order">
<option value="" disabled selected>Order by</option>
<option value="a-z">A-Z</option>
<option value="z-a">Z- A</option>
<option value="num1-251">Ascending Pokedex Num</option>
<option value="num251-1">Descending Pokedex Num</option>
</select>
<button id="orderButton">Order</button>
<button id="clearFilterButton">Clean Filter</button>
</nav>

<dialog id="dialog">
<form method="dialog">
<section id="pokemon-info">
<h2 id="pokeName"></h2>
<p id="pokeNumber"></p>
<img id="pokeImg" alt="Pokemon Image" />
<p id="pokeType"></p>
</section>
<section id="resistance-weakness">
<h2>Resistance & Weaknesses</h2>
<p id="resistant-Weak"></p>
</section>
<section id="attacks">
<h2>Attacks</h2>
<p id="move"></p>
</section>
<section id="evolutions">
<h2>Evolutions</h2>
<p id="evolution"></p>
</section>
<button id="dialogClose">Close</button>
</form>
</dialog>

<section id="pokemon-grid"></section>
</div>

<div id="root"></div>
<script src="main.js" type="module"></script>
</body>
Expand Down
Loading