Change number in PokemonCardProps to id
parent
9338a70918
commit
609b5621f1
|
@ -56,8 +56,8 @@ const Pokedex = () => {
|
||||||
sortedFilteredPokemonList.map(pokemon => (
|
sortedFilteredPokemonList.map(pokemon => (
|
||||||
<PokemonCard
|
<PokemonCard
|
||||||
key={pokemon.id}
|
key={pokemon.id}
|
||||||
|
id={pokemon.id}
|
||||||
name={pokemon.name}
|
name={pokemon.name}
|
||||||
number={pokemon.id}
|
|
||||||
image={pokemon.sprites.other.dream_world.front_default}
|
image={pokemon.sprites.other.dream_world.front_default}
|
||||||
types={pokemon.types.map(type => type.type.name)}
|
types={pokemon.types.map(type => type.type.name)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -19,16 +19,16 @@ const Template: ComponentStory<typeof PokemonCard> = (
|
||||||
export const Primary = Template.bind({});
|
export const Primary = Template.bind({});
|
||||||
|
|
||||||
Primary.args = {
|
Primary.args = {
|
||||||
|
id: 6,
|
||||||
name: charizard_info.name,
|
name: charizard_info.name,
|
||||||
number: 6,
|
|
||||||
image: charizard_svg,
|
image: charizard_svg,
|
||||||
types: ['fire', 'flying'],
|
types: ['fire', 'flying'],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Charizard = Template.bind({});
|
export const Charizard = Template.bind({});
|
||||||
Charizard.args = {
|
Charizard.args = {
|
||||||
|
id: 6,
|
||||||
name: charizard_info.name,
|
name: charizard_info.name,
|
||||||
number: 6,
|
|
||||||
image: charizard_svg,
|
image: charizard_svg,
|
||||||
types: ['fire', 'flying'],
|
types: ['fire', 'flying'],
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,8 +6,8 @@ import * as pokeTypeAsset from './assets';
|
||||||
import { colorTypeGradients } from './utils';
|
import { colorTypeGradients } from './utils';
|
||||||
|
|
||||||
export interface PokemonCardProps {
|
export interface PokemonCardProps {
|
||||||
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
number: number;
|
|
||||||
image: string;
|
image: string;
|
||||||
types: string[];
|
types: string[];
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ function findPokeTypeAsset(pokeType: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PokemonCard({
|
export default function PokemonCard({
|
||||||
|
id,
|
||||||
name,
|
name,
|
||||||
number,
|
|
||||||
image,
|
image,
|
||||||
types,
|
types,
|
||||||
}: PokemonCardProps) {
|
}: PokemonCardProps) {
|
||||||
|
@ -81,7 +81,7 @@ export default function PokemonCard({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="card__header">
|
<div className="card__header">
|
||||||
<div className="poke__number">{formatNumber(number)}</div>
|
<div className="poke__number">{formatNumber(id)}</div>
|
||||||
<div className="info__icon">
|
<div className="info__icon">
|
||||||
<svg
|
<svg
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
|
|
Loading…
Reference in New Issue