The Ability Explorer allows users to discover all Pokemon that share a specific ability.
Overview
When users click on an ability from a Pokemon’s detail page, they’re taken to a filtered view showing all Pokemon with that ability:
- Dynamic route-based filtering
- Grid layout of Pokemon names
- Direct links to each Pokemon’s detail page
- Clean, organized presentation
Route Parameter
The ability name is passed through the URL route:
import { useRoute } from 'vue-router';
const route = useRoute();
// Route parameter: route.params.habilidad
Data Fetching
The component fetches Pokemon data from the PokeAPI’s ability endpoint:
import axios from 'axios';
import { ref } from 'vue';
const pokemons = ref([]);
const getData = async () => {
try {
const { data } = await axios.get(`https://pokeapi.co/api/v2/ability/${route.params.habilidad}`);
console.log(data);
pokemons.value = data.pokemon.map((item) => item.pokemon);
} catch (error) {
console.error('Error fetching Pokémon:', error);
}
};
getData();
The PokeAPI’s ability endpoint returns all Pokemon that can have that ability, including hidden abilities.
Template Structure
The view displays a title with the ability name and a grid of Pokemon:
<template>
<div class="habilidad-container">
<h1 class="titulo-habilidad">
Pokémon con la habilidad:
<span class="nombre-habilidad">{{ route.params.habilidad }}</span>
</h1>
<div class="pokemon-grid">
<RouterLink
v-for="(poke, index) in pokemons"
:key="index"
:to="`/pokemons/${poke.name}`"
class="pokemon-item"
>
{{ poke.name }}
</RouterLink>
</div>
<VolverPokemons />
</div>
</template>
Grid Layout
Pokemon are displayed in a responsive grid:
.pokemon-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1.5rem;
margin: 3rem 0;
padding: 0;
}
@media (max-width: 768px) {
.pokemon-grid {
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
}
Pokemon Card Styling
Each Pokemon card has hover effects and smooth animations:
.pokemon-item {
background: #2d3748;
border: 1px solid #4a5568;
border-radius: 14px;
padding: 1.5rem;
text-align: center;
text-decoration: none;
color: #f7fafc;
font-weight: 600;
font-size: 1.1rem;
text-transform: capitalize;
transition: all 0.3s ease;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
position: relative;
overflow: hidden;
}
.pokemon-item:hover {
transform: translateY(-6px);
border-color: #10b981;
box-shadow: 0 8px 20px rgba(16,185,129,0.15);
color: #10b981;
}
Shimmer Effect
Cards feature a subtle shimmer effect on hover:
.pokemon-item::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, rgba(16,185,129,0.15), rgba(16,185,129,0));
transition: all 0.4s ease;
}
.pokemon-item:hover::before {
left: 100%;
}
The shimmer creates a sweep effect from left to right when hovering over Pokemon cards.
Navigation Flow
View Pokemon Details
User views a Pokemon’s detail page and sees its abilities listed.
Click Ability
User clicks on an ability link, which routes to /pokemons/ability/{ability-name}.
Fetch Data
The Ability Explorer fetches all Pokemon with that ability from the PokeAPI.
Display Results
Pokemon are displayed in a grid, each linking back to their detail pages.
Return Navigation
User can click any Pokemon to view details or use the back button to return to the main Pokedex.
Title Styling
The page title features gradient text for the ability name:
.titulo-habilidad {
color: #293851;
margin-bottom: 2rem;
font-size: 2.5rem;
font-weight: 700;
text-transform: capitalize;
letter-spacing: 0.5px;
}
.nombre-habilidad {
color: #10b981;
font-weight: 700;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
@media (max-width: 768px) {
.titulo-habilidad {
font-size: 2rem;
}
}
Integration with Detail Page
Abilities are linked from the Pokemon detail page’s About tab:
<div class="info-row">
<span class="info-label">Habilidades:</span>
<div class="abilities">
<RouterLink
v-for="ability in datos.abilities"
:key="ability.ability.name"
:to="`/pokemons/ability/${ability.ability.name}`"
class="ability-link"
>
{{ ability.ability.name.replace('-', ' ') }}
</RouterLink>
</div>
</div>
API Response Structure
The PokeAPI ability endpoint returns:
{
"name": "overgrow",
"pokemon": [
{
"pokemon": {
"name": "bulbasaur",
"url": "https://pokeapi.co/api/v2/pokemon/1/"
}
},
{
"pokemon": {
"name": "ivysaur",
"url": "https://pokeapi.co/api/v2/pokemon/2/"
}
}
]
}
The component extracts just the Pokemon objects:
pokemons.value = data.pokemon.map((item) => item.pokemon);
Use Cases
Discover Similar Pokemon
Learn About Abilities
Exploration
Users can find Pokemon with similar abilities, useful for team building or discovering related Pokemon.
See which Pokemon share a specific ability to understand its prevalence and strategic value.
Navigate between Pokemon by exploring shared abilities, creating a web of discovery.
Pokemon Details
View abilities and click to explore them
Search & Filter
Search for specific Pokemon by name