|
1 | 1 | import React from 'react';
|
2 | 2 | import MovieCard from './MovieCard';
|
| 3 | +import PageNum from './PageNum'; |
3 | 4 | import { useFetch } from './useFetch';
|
4 | 5 |
|
5 | 6 | const Movies = (props) => {
|
@@ -27,26 +28,35 @@ const Movies = (props) => {
|
27 | 28 |
|
28 | 29 | return (
|
29 | 30 | <React.Fragment>
|
30 |
| - {isSearch === false ? ( |
31 |
| - <div className='card mt-4'> |
32 |
| - <div className='card-body'> |
33 |
| - <div className='text-secondary pt-2 text-centerr'>Hit search to get some results</div> |
34 |
| - </div> |
| 31 | + <div className='row'> |
| 32 | + <div className='col-12' style={{ paddingLeft: '15%', paddingRight: '15%' }}> |
| 33 | + {isSearch === false ? ( |
| 34 | + <div className='card mt-4'> |
| 35 | + <div className='card-body'> |
| 36 | + <div className='text-secondary pt-2 text-centerr'>Hit search to get some results</div> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + ) : data['Response'] !== 'True' ? ( |
| 40 | + <div className='card mt-4'> |
| 41 | + <div className='card-body'> |
| 42 | + <div className='text-secondary pt-2 text-centerr'>{data['Error']}</div> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + ) : ( |
| 46 | + <div className='row p-5'> |
| 47 | + {data['Search']?.map((dataItem) => { |
| 48 | + return <MovieCard key={dataItem['imdbID']} {...dataItem} />; |
| 49 | + })} |
| 50 | + </div> |
| 51 | + )} |
35 | 52 | </div>
|
36 |
| - ) : data['Response'] !== 'True' ? ( |
37 |
| - <div className='card mt-4'> |
38 |
| - <div className='card-body'> |
39 |
| - <div className='text-secondary pt-2 text-centerr'>{data['Error']}</div> |
40 |
| - </div> |
41 |
| - </div> |
42 |
| - ) : ( |
43 |
| - <div className='row p-5'> |
44 |
| - {props['setTotalPages'](data['totalResults']) && |
45 |
| - data['Search']?.map((dataItem) => { |
46 |
| - return <MovieCard key={dataItem['imdbID']} {...dataItem} />; |
47 |
| - })} |
| 53 | + </div> |
| 54 | + |
| 55 | + <div className='row'> |
| 56 | + <div className='col-12' style={{ paddingLeft: '15%', paddingRight: '15%' }}> |
| 57 | + <PageNum setSearchTerm={props['setSearchTerm']} searchTerm={props['searchTerm']} totalResults={data['totalResults']} /> |
48 | 58 | </div>
|
49 |
| - )} |
| 59 | + </div> |
50 | 60 | </React.Fragment>
|
51 | 61 | );
|
52 | 62 | };
|
|
0 commit comments