Skip to content

Commit

Permalink
[#45] - Pokemon image component
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanson25 committed Oct 10, 2024
1 parent d88216b commit db83c91
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/vue/components/PokemonPicture.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<section>
<img
v-if="!showPokemon"
:src="pokemonImage"
class="brightness-0 h-[200px]"
/>
<img
v-else
:src="pokemonImage"
class="fade-in h-[200px]"
alt="pokemon image"
/>
</section>
</template>

<script setup lang="ts">
import { computed } from 'vue';
interface Props {
pokemonId: number;
showPokemon?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
showPokemon: false,
});
const pokemonImage = computed(
() =>
`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/dream-world/${props.pokemonId}.svg`,
);
</script>

<style scoped>
img {
user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
}
</style>

0 comments on commit db83c91

Please sign in to comment.