-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
70 lines (66 loc) · 1.83 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import ErrorBoundary from "../components/others/ErrorBoundary";
import MovieList from "../components/movies/MovieList";
import Search from "../components/others/search/Search";
import Layout from "../components/layout";
import Head from "next/head";
import { getData } from "../services/ApiService";
export async function getStaticProps() {
const popular = await getData("movie", "popular");
const upcoming = await getData("movie", "upcoming");
const topRated = await getData("movie", "top_rated");
return {
props: {
popular: popular.data.results,
upcoming: upcoming.data.results,
topRated: topRated.data.results,
},
};
}
function Index({ popular, upcoming, topRated }) {
return (
<Layout>
<Head>
<title>
Millions of movies, TV shows and people to discover. Explore now -
MovieDB
</title>
</Head>
<ErrorBoundary>
<Search />
</ErrorBoundary>
<div className="container">
<ErrorBoundary>
<MovieList
title="What's Popular"
styles="d-flex movies-wrapper"
category="movie"
data={popular}
/>
</ErrorBoundary>
</div>
<div className="bg-light-blue text-white">
<div className="container">
<ErrorBoundary>
<MovieList
title="Upcoming movies"
styles="d-flex movies-wrapper"
category="movie"
data={upcoming}
/>
</ErrorBoundary>
</div>
</div>
<div className="container">
<ErrorBoundary>
<MovieList
title="Top Rated"
styles="d-flex movies-wrapper"
category="movie"
data={topRated}
/>
</ErrorBoundary>
</div>
</Layout>
);
}
export default Index;