blob: d5e2855298d2832829f148b3a48a2fe9cb3b40a8 (
plain) (
blame)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
import { Card, CardHeader, CardBody, Image, Link } from "@nextui-org/react";
import NextImage from "next/image";
import { DramaDataFetcher } from "./components/requests";
import styles from "../page.module.css";
import { Searchbar } from "./components/searchBar";
import { PreFetchKdramaInfo } from "./components/cacher";
const KdramaHomepage = async () => {
const recent_data = await DramaDataFetcher("recent");
const popular_data = await DramaDataFetcher("popular");
const dataToBeLoaded = [recent_data, popular_data];
for (let item of dataToBeLoaded) {
PreFetchKdramaInfo(item);
}
const header = (title) => (
<>
<p className="antialiased font-bold text-sky-400 text-2xl my-1">
{title}
</p>
</>
);
const format = (data) => (
<>
{data &&
data.results.map((item, index) => (
<Link
key={index}
href={`/kdrama/${encodeURIComponent(item.id)}`}
aria-label="anime redirection links"
className="flex flex-col items-center mx-1"
>
<Card className="overflow-visible " isPressable>
<CardBody>
<Image
as={NextImage}
isBlurred
alt="Anime Poster"
src={item.image}
width={270}
height={160}
className="h-60 overflow-hidden"
shadow="lg"
priority
/>
</CardBody>
<CardHeader>
<h4
className={`antialiased text-small text-center uppercase w-44 overflow-hidden whitespace-nowrap text-ellipsis `}
>
{item.title}
</h4>
</CardHeader>
</Card>
</Link>
))}
</>
);
return (
<section className="pt-12">
<div>
<Searchbar />
</div>
<div className="mx-2">
{header("Popular K-dramas")}
<div
className={`flex overflow-auto overflow-y-hidden pb-3 ${styles.ScrollBarAdjuster}`}
>
{format(popular_data)}
</div>
</div>
<div className="mx-2">
{header("Recent Releases")}
<div
className={`flex overflow-auto overflow-y-hidden pb-3 ${styles.ScrollBarAdjuster}`}
>
{format(recent_data)}
</div>
</div>
<br />
<br />
<br />
<br />
<br />
</section>
);
};
export default KdramaHomepage;
|