aboutsummaryrefslogtreecommitdiff
path: root/src/app/anime/top-airing/page.jsx
blob: 3d26d88e8239cdfcbf51725e439be41bee64b23c (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
import styles from "./trending.module.css";
import Image from "next/image";
import Link from "next/link";
import { HiTrendingUp } from "react-icons/hi";

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

	return (
		<div className="trendingContainer">
			<div className={styles.TrendingText}>
				<p>Trending</p>
				<span>
					<HiTrendingUp size={26} color="aqua" />
				</span>
			</div>

			<div className="trending">
				{data &&
					data.results.map((item, index) => (
						<Link
							key={index}
							href={`/anime/${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://consumet-api-di2e.onrender.com/anime/gogoanime/top-airing",
		{ cache: "force-cache" }
	);
	const data = res.json();
	return data;
}