Move Loading screen into Pokedex.tsx
parent
33b1f4f79c
commit
db682dc2a2
10
src/App.tsx
10
src/App.tsx
|
@ -2,18 +2,8 @@ import React from 'react';
|
|||
import './App.css';
|
||||
import Header from 'components/Header';
|
||||
import Pokedex from './features/Pokedex';
|
||||
import { useGetPokemonListQuery } from './features/Pokedex/pokedexApi';
|
||||
import Loading from './components/Loading';
|
||||
|
||||
function App() {
|
||||
const { data, error, isLoading } = useGetPokemonListQuery(100);
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="App app_container">
|
||||
<Loading />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="App app_container">
|
||||
<Header />
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
import React from 'react';
|
||||
import Pokemon from './Pokemon';
|
||||
import Filters from './Filters';
|
||||
import { useGetPokemonListQuery } from './pokedexApi';
|
||||
import Loading from 'components/Loading';
|
||||
|
||||
import charizard from 'features/Pokedex/Pokemon/assets/stories/charizard.svg';
|
||||
|
||||
const Pokedex = () => {
|
||||
const { data, error, isLoading } = useGetPokemonListQuery(100);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Filters />
|
||||
{isLoading ? (
|
||||
<Loading />
|
||||
) : (
|
||||
<Pokemon
|
||||
name={'Charizard'}
|
||||
number={6}
|
||||
image={charizard}
|
||||
types={['fire', 'flying']}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue