Skip to content

Commit

Permalink
feat(tracker): Add name of pokemon on hover in evolution chain
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 27, 2017
1 parent 4a10b53 commit 87946a8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions app/components/evolution-family.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function EvolutionFamily ({ dex, family, setCurrentPokemon }) {
if (family.pokemon.length > 1) {
column1 = (
<div className="evolution-pokemon-column">
{family.pokemon[1].map((pokemon) => <a key={pokemon.id} onClick={() => setCurrentPokemon(pokemon.id)}>
{family.pokemon[1].map((pokemon) => <a key={pokemon.id} onClick={() => setCurrentPokemon(pokemon.id)} title={pokemon.name}>
<i className={iconClass(pokemon, dex)} />
</a>)}
</div>
Expand All @@ -21,7 +21,7 @@ export function EvolutionFamily ({ dex, family, setCurrentPokemon }) {
if (family.pokemon.length > 2) {
column2 = (
<div className="evolution-pokemon-column">
{family.pokemon[2].map((pokemon) => <a key={pokemon.id} onClick={() => setCurrentPokemon(pokemon.id)}>
{family.pokemon[2].map((pokemon) => <a key={pokemon.id} onClick={() => setCurrentPokemon(pokemon.id)} title={pokemon.name}>
<i className={iconClass(pokemon, dex)} />
</a>)}
</div>
Expand All @@ -31,7 +31,7 @@ export function EvolutionFamily ({ dex, family, setCurrentPokemon }) {
return (
<div className="info-evolutions">
<div className="evolution-pokemon-column">
<a onClick={() => setCurrentPokemon(family.pokemon[0][0].id)}>
<a onClick={() => setCurrentPokemon(family.pokemon[0][0].id)} title={family.pokemon[0][0].name}>
<i className={iconClass(family.pokemon[0][0], dex)} />
</a>
{family.evolutions.length === 0 ? <div>Does not evolve</div> : null}
Expand All @@ -48,10 +48,6 @@ function mapStateToProps ({ currentDex, currentUser, users }) {
return { dex: users[currentUser].dexesBySlug[currentDex] };
}

function mapDispatchToProps (dispatch) {
return {
setCurrentPokemon: (id) => dispatch(setCurrentPokemon(id))
};
}
const mapDispatchToProps = { setCurrentPokemon };

export const EvolutionFamilyComponent = connect(mapStateToProps, mapDispatchToProps)(EvolutionFamily);

0 comments on commit 87946a8

Please sign in to comment.