aboutsummaryrefslogtreecommitdiff
path: root/src/app/top-airing/page.jsx
blob: 8b97183cc402f62f357bc3e58c3bb9635aa9bf51 (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
import "./trending.css";
import Image from "next/image";
import Link from "next/link";

export default async function Trending() {
	const data = await test();

	return (
		<div className="trendingContainer">
			<p className="trendingText">Trending</p>

			<div className="trending">
				{data &&
					data.results.map((item, index) => (
						<Link
							key={index}
							href={`/info/${item.id}`}
							style={{ textDecoration: "none" }}
						>
							<div className="trendingEntries">
								<Image
									src={item.image}
									className="{trendingImage}"
									width={160}
									height={220}
									alt="Drama"
									priority
								/>
								<p>{item.title}</p>
							</div>
						</Link>
					))}
			</div>
		</div>
	);
}

async function test() {
	const res = await fetch(
		"https://dramalama-api.vercel.app/anime/gogoanime/top-airing",
		{ cache: "force-cache" }
	);
	const data = res.json();
	return data;
}