diff --git a/src/components/Image.tsx b/src/components/Image.tsx new file mode 100644 index 0000000..192cddf --- /dev/null +++ b/src/components/Image.tsx @@ -0,0 +1,29 @@ + +export type ImageProps = { + key?: string; + className?: string; + src: string; + alt: string; + width: number; + height: number; + loading?: 'eager' | 'lazy' | undefined; + title?: string; +}; + +export function Image({ key, className, src, alt, width, height, loading, title }: ImageProps) { + + const fullSource : string = `${import.meta.env.BASE_URL}${src}`; + + return ( + {alt} + ); +} diff --git a/src/components/ItemCard.tsx b/src/components/ItemCard.tsx index 72b830f..b4f52d5 100644 --- a/src/components/ItemCard.tsx +++ b/src/components/ItemCard.tsx @@ -1,6 +1,7 @@ import { ElementNames } from "../data/elements"; import { get_item } from "../data/items"; import { get_move } from "../data/moves"; +import { Image } from "./Image"; export type ItemCardProps = { itemID: number; @@ -32,7 +33,7 @@ export function ItemCard({ itemID, clicked }: ItemCardProps) { )}
- {item.name}
- {move.name} - {menu.name} + {menu.name} {' '} {menu.name} diff --git a/src/components/PokemonCard.tsx b/src/components/PokemonCard.tsx index 084c794..5586489 100644 --- a/src/components/PokemonCard.tsx +++ b/src/components/PokemonCard.tsx @@ -1,5 +1,6 @@ import { PokemonElements } from "./PokemonElement"; import { PokemonGameVersionNames, PokemonAvailableGameVersionNames, get_pokemon } from "../data/pokemon"; +import { Image } from "./Image"; export type PokemonSelectionProps = { pokemonID: number; @@ -26,14 +27,14 @@ export function PokemonCard({ pokemonID, active, forceInPokeball, clicked }: Pok
{pokemon.available.map((game) => { return ( - {PokemonGameVersionNames[game]} ); @@ -41,7 +42,7 @@ export function PokemonCard({ pokemonID, active, forceInPokeball, clicked }: Pok
{pokemon.name}
- {pokemon.name} + {pokemon.name}
#{pokemon.id}
diff --git a/src/components/itemdex/ItemdexPicture.tsx b/src/components/itemdex/ItemdexPicture.tsx index a03b828..91a0346 100644 --- a/src/components/itemdex/ItemdexPicture.tsx +++ b/src/components/itemdex/ItemdexPicture.tsx @@ -1,4 +1,5 @@ import { Item } from "../../data/items"; +import { Image } from "../Image"; export type ItemdexPictureProps = { item: Item; @@ -15,7 +16,7 @@ export function ItemdexPicture({ item }: ItemdexPictureProps) {
- {item.name} + {item.name}
diff --git a/src/components/movedex/movedexPicture.tsx b/src/components/movedex/movedexPicture.tsx index 003515c..0ebc593 100644 --- a/src/components/movedex/movedexPicture.tsx +++ b/src/components/movedex/movedexPicture.tsx @@ -1,4 +1,5 @@ import { Move } from "../../data/moves"; +import { Image } from "../Image"; export type MovedexPictureProps = { move: Move; @@ -15,7 +16,7 @@ export function MovedexPicture({ move }: MovedexPictureProps) {
- {move.name} + {move.name}
diff --git a/src/components/pokedex/PokedexEvolutions.tsx b/src/components/pokedex/PokedexEvolutions.tsx index 42467f3..65142a4 100644 --- a/src/components/pokedex/PokedexEvolutions.tsx +++ b/src/components/pokedex/PokedexEvolutions.tsx @@ -1,6 +1,7 @@ import { Link } from "react-router-dom"; import { EvolveTo, Pokemon, PokemonEvolutionType, get_pokemon, get_pokemon_base, get_pokemon_evolution_index, get_pokemon_name_span } from "../..//data/pokemon"; import { get_item, get_item_id_name_span, get_item_name_span } from "../../data/items"; +import { Image } from "../Image"; type PokedexEvolutionPokemonProps = { pokemon: Pokemon; @@ -13,7 +14,7 @@ function PokedexEvolutionPokemon({ pokemon }: PokedexEvolutionPokemonProps) { - {pokemon.name} - Trade - LevelUp - {item.name}
- {PokemonGameVersionNames[game]} {PokemonGameVersionNames[game]}
diff --git a/src/components/pokedex/PokedexPicture.tsx b/src/components/pokedex/PokedexPicture.tsx index 68c5d77..428bd1e 100644 --- a/src/components/pokedex/PokedexPicture.tsx +++ b/src/components/pokedex/PokedexPicture.tsx @@ -1,4 +1,5 @@ import { Pokemon } from "../../data/pokemon"; +import { Image } from "../Image"; export type PokedexPictureProps = { pokemon: Pokemon; @@ -15,7 +16,7 @@ export function PokedexPicture({ pokemon }: PokedexPictureProps) {
-