@@ -11,10 +11,10 @@ function renderPokemonIndex(pokemons: Array<Pokemon>): string {
11
11
const pokemonLinks = pokemons . map (
12
12
( pokemon ) => `
13
13
<li>
14
- <a class="pokemon-card" href="${ String ( pokemon . id ) . padStart ( 4 , '0' ) } _${ pokemon . name } .html" data-types='${ JSON . stringify ( pokemon . types ) } ' data-baby='${ pokemon . is_baby } ' data-legendary='${ pokemon . is_legendary } ' data-mythical='${ pokemon . is_mythical } ' style="background-image: linear-gradient(135deg, ${ getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 0%, ${ getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 50%, ${ pokemon . types [ 1 ] ? getTypeColor ( toPokemonType ( pokemon . types [ 1 ] ) ) : getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 50%, ${ pokemon . types [ 1 ] ? getTypeColor ( toPokemonType ( pokemon . types [ 1 ] ) ) : getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 100%);">
14
+ <a class="pokemon-card" href="${ String ( pokemon . id ) . padStart ( 4 , '0' ) } _${ pokemon . codename } .html" data-types='${ JSON . stringify ( pokemon . types ) } ' data-baby='${ pokemon . is_baby } ' data-legendary='${ pokemon . is_legendary } ' data-mythical='${ pokemon . is_mythical } ' style="background-image: linear-gradient(135deg, ${ getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 0%, ${ getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 50%, ${ pokemon . types [ 1 ] ? getTypeColor ( toPokemonType ( pokemon . types [ 1 ] ) ) : getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 50%, ${ pokemon . types [ 1 ] ? getTypeColor ( toPokemonType ( pokemon . types [ 1 ] ) ) : getTypeColor ( toPokemonType ( pokemon . types [ 0 ] ) ) } 100%);">
15
15
<div class="pokemon-id">#${ String ( pokemon . id ) . padStart ( 4 , '0' ) } </div>
16
16
<img src="${ pokemon . imageUrl } " alt="${ pokemon . name } " />
17
- <h2>${ pokemon . name . charAt ( 0 ) . toUpperCase ( ) + pokemon . name . slice ( 1 ) } </h2>
17
+ <h2>${ pokemon . name } </h2>
18
18
</a>
19
19
</li>`
20
20
) . join ( '\n' ) ;
@@ -83,7 +83,7 @@ function renderPokemonIndex(pokemons: Array<Pokemon>): string {
83
83
const isBaby = JSON.parse(pokemonCard.dataset.baby);
84
84
const isLegendary = JSON.parse(pokemonCard.dataset.legendary);
85
85
const isMythical = JSON.parse(pokemonCard.dataset.mythical);
86
- const nameMatch = searchText === "" || pokemonName.includes(searchText);
86
+ const nameMatch = searchText === "" || pokemonName.includes(searchText.toLowerCase() );
87
87
const typeMatch = selectedType === "" || pokemonTypes.includes(selectedType);
88
88
const babyMatch = !babyFilter || isBaby;
89
89
const legendaryMatch = !legendaryFilter || isLegendary;
@@ -171,7 +171,7 @@ function renderPokemonIndex(pokemons: Array<Pokemon>): string {
171
171
<html>
172
172
${ head ( pokemon . name ) }
173
173
<body>
174
- <h1><a href="index.html" class="back-to-menu"><i class="fas fa-arrow-left"></i></a> ${ pokemon . name . charAt ( 0 ) . toUpperCase ( ) + pokemon . name . slice ( 1 ) } <span class="pokemon-id">#${ String ( pokemon . id ) . padStart ( 4 , '0' ) } </span></h1>
174
+ <h1><a href="index.html" class="back-to-menu"><i class="fas fa-arrow-left"></i></a> ${ pokemon . name } <span class="pokemon-id">#${ String ( pokemon . id ) . padStart ( 4 , '0' ) } </span></h1>
175
175
<div class="pokemon-container">
176
176
<img src="${ pokemon . officialArtworkUrl } " alt="${ pokemon . name } " />
177
177
<table>
@@ -300,6 +300,6 @@ function head(title: string): string {
300
300
continue ;
301
301
}
302
302
const detailHtml = renderPokemonDetail ( pokemonDetail ) ;
303
- await writeFile ( `${ String ( pokemonDetail . id ) . padStart ( 4 , '0' ) } _${ pokemonDetail . name } .html` , detailHtml ) ;
303
+ await writeFile ( `${ String ( pokemonDetail . id ) . padStart ( 4 , '0' ) } _${ pokemonDetail . codename } .html` , detailHtml ) ;
304
304
}
305
305
} ) ( ) ;
0 commit comments