blob: 21d8cc3d3b9dbb8b3b3a572db0583b895c652ac5 (
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
|
import styles from "../styles/popular.module.css";
import Image from "next/image";
import Link from "next/link";
import { PreFetchAnimeInfo } from "./cacher";
export default async function PopularDramas() {
const popular = await getPopular();
PreFetchAnimeInfo(popular);
return (
<div className={styles.Main}>
<h2 className={styles.popDramasText}>Trending Dramas</h2>
<div className={styles.AnimeContainer}>
{popular &&
popular.results.slice(0, 24).map((item, index) => (
<Link
href={`/kdrama/${encodeURIComponent(item.id)}`}
key={index}
style={{ textDecoration: "none" }}
>
<div
className={styles.AnimeEntry}
title={item.title}
>
<Image
src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item.image}`}
width={167}
height={267}
alt="Drama Poster"
/>
<p>{item.title}</p>
</div>
</Link>
))}
</div>
</div>
);
}
async function getPopular() {
const res = await fetch("https://dramacool-scraper.vercel.app/popular", {
next: { revalidate: 21600 },
});
const data = await res.json();
return data;
}
|