Moved poke types into src/features/Pokedex/Pokemon/assets directory

This commit is contained in:
Jason Zhu 2023-03-23 00:12:29 +11:00
parent 0b5a98d859
commit cf9e5d490d
23 changed files with 26 additions and 14 deletions

View File

@ -14,11 +14,11 @@ module.exports = {
},
webpackFinal: async config => {
config.resolve.plugins = config.resolve.plugins || [];
config.resolve.plugins = [
config.resolve.plugins.push(
new TsconfigPathsPlugin({
configFile: path.resolve(__dirname, '../tsconfig.json'),
}),
];
);
return config;
},
};

View File

@ -2,13 +2,18 @@ import React from 'react';
import Pokemon from './Pokemon';
import Filters from './Filters';
import charizard from 'assets/charizard.svg';
import charizard from 'features/Pokedex/Pokemon/assets/stories/charizard.svg';
const Pokedex = () => {
return (
<>
<Filters />
<Pokemon name={'Charizard'} number={'#006'} image={charizard} />
<Pokemon
name={'Charizard'}
number={6}
image={charizard}
types={['fire', 'flying']}
/>
</>
);
};

View File

@ -3,7 +3,9 @@ import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import Pokemon, { PokemonProps } from './Pokemon';
import charizard from 'assets/charizard.svg';
import charizard_svg from './assets/stories/charizard.svg';
import charizard_info from './assets/stories/charizard.json';
export default {
title: 'Pokedex/PokemonCard',
@ -17,14 +19,14 @@ const Template: ComponentStory<typeof Pokemon> = (args: PokemonProps) => (
export const Primary = Template.bind({});
Primary.args = {
name: 'Charizard',
number: '#006',
image: charizard,
name: charizard_info.name,
number: 6,
image: charizard_svg,
};
export const Charizard = Template.bind({});
Charizard.args = {
name: 'Charizard',
number: '#006',
image: charizard,
name: charizard_info.name,
number: 6,
image: charizard_svg,
};

View File

@ -3,15 +3,16 @@ import './Pokemon.css';
export interface PokemonProps {
name: string;
number: string;
number: number;
image: string;
types: string[];
}
export default function Pokemon({ name, number, image }: PokemonProps) {
return (
<div className="thumbnail__container">
<div className="card__header">
<div className="poke__number">{number}</div>
<div className="poke__number">{formatNumber(number)}</div>
<div className="info__icon">
<svg
stroke="currentColor"
@ -27,7 +28,7 @@ export default function Pokemon({ name, number, image }: PokemonProps) {
</div>
</div>
<div className="image__container">
<img src={image} alt="test" height={150} />
<img src={image} alt={name} height={150} />
</div>
<div className="poke__name">
<h3>{name}</h3>
@ -35,3 +36,7 @@ export default function Pokemon({ name, number, image }: PokemonProps) {
</div>
);
}
function formatNumber(num: number) {
return '#' + num.toString().padStart(3, '0');
}

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB