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 './App.css';
|
||||||
import Header from 'components/Header';
|
import Header from 'components/Header';
|
||||||
import Pokedex from './features/Pokedex';
|
import Pokedex from './features/Pokedex';
|
||||||
import { useGetPokemonListQuery } from './features/Pokedex/pokedexApi';
|
|
||||||
import Loading from './components/Loading';
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { data, error, isLoading } = useGetPokemonListQuery(100);
|
|
||||||
if (isLoading) {
|
|
||||||
return (
|
|
||||||
<div className="App app_container">
|
|
||||||
<Loading />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div className="App app_container">
|
<div className="App app_container">
|
||||||
<Header />
|
<Header />
|
||||||
|
|
|
@ -1,19 +1,27 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Pokemon from './Pokemon';
|
import Pokemon from './Pokemon';
|
||||||
import Filters from './Filters';
|
import Filters from './Filters';
|
||||||
|
import { useGetPokemonListQuery } from './pokedexApi';
|
||||||
|
import Loading from 'components/Loading';
|
||||||
|
|
||||||
import charizard from 'features/Pokedex/Pokemon/assets/stories/charizard.svg';
|
import charizard from 'features/Pokedex/Pokemon/assets/stories/charizard.svg';
|
||||||
|
|
||||||
const Pokedex = () => {
|
const Pokedex = () => {
|
||||||
|
const { data, error, isLoading } = useGetPokemonListQuery(100);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Filters />
|
<Filters />
|
||||||
<Pokemon
|
{isLoading ? (
|
||||||
name={'Charizard'}
|
<Loading />
|
||||||
number={6}
|
) : (
|
||||||
image={charizard}
|
<Pokemon
|
||||||
types={['fire', 'flying']}
|
name={'Charizard'}
|
||||||
/>
|
number={6}
|
||||||
|
image={charizard}
|
||||||
|
types={['fire', 'flying']}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue