Implemented index.ts for small components

This commit is contained in:
Jason Zhu 2023-03-22 20:32:04 +11:00
parent 47558e17d3
commit a29c471a0b
7 changed files with 17 additions and 11 deletions

View File

@ -1,8 +1,7 @@
import React from 'react';
import './App.css';
import Header from 'components/Header';
import Filters from './features/Pokedex/Filters/Filters';
import { Pokedex } from './features/Pokedex/Pokedex';
import Pokedex from './features/Pokedex';
import { useGetPokemonListQuery } from './features/Pokedex/pokedexApi';
import Loading from './components/Loading';
@ -18,7 +17,6 @@ function App() {
return (
<div className="App app_container">
<Header />
<Filters />
<Pokedex />
</div>
);

View File

@ -1 +1 @@
export * from './Filters';
export { default } from './Filters';

View File

@ -1,8 +1,16 @@
import React from 'react';
import { Pokemon } from './Pokemon';
import Pokemon from './Pokemon';
import Filters from './Filters';
import charizard from 'assets/charizard.svg';
export function Pokedex() {
return <Pokemon name={'Charizard'} number={'#006'} image={charizard} />;
}
const Pokedex = () => {
return (
<>
<Filters />
<Pokemon name={'Charizard'} number={'#006'} image={charizard} />
</>
);
};
export default Pokedex;

View File

@ -7,7 +7,7 @@ export interface PokemonProps {
image: string;
}
export function Pokemon({ name, number, image }: PokemonProps) {
export default function Pokemon({ name, number, image }: PokemonProps) {
return (
<div className="thumbnail__container">
<div className="card__header">

View File

@ -1 +1,2 @@
export * from './Pokemon';
export { default } from './Pokemon';

View File

@ -0,0 +1 @@
export { default } from './Pokedex';

View File

@ -2,8 +2,6 @@ import { createSlice } from '@reduxjs/toolkit';
import type { PayloadAction } from '@reduxjs/toolkit';
import type { RootState } from 'app/store';
import { PokemonProps as Pokemon } from './Pokemon';
interface PokedexState {
selectedRegion: string;
selectedType: string;