aboutsummaryrefslogtreecommitdiff
path: root/src/app/anime/search/components/fetchedInfo.js
blob: 359e745bb128f98f00b3050e82f478b1a43a72f5 (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 styles from "../search.module.css";
import Link from "next/link";
import Image from "next/image";
import { preFetchAnimeInfo } from "../../videoLinkfetcher";

export default async function fetchedInfo(data) {
	preFetchAnimeInfo(data);
	return (
		<div className={styles.animeEntry}>
			{data ? (
				data.results && data.results.length > 0 ? (
					data.results.map((item, index) => (
						<Link
							key={index}
							href={`/anime/${item.id}`}
							style={{ textDecoration: "none" }}
						>
							<div className={styles.anime}>
								<p>{item.title}</p>
								<Image
									src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item.image}`}
									className={styles.animeImage}
									width={120}
									height={180}
									alt="Drama Poster"
								/>
							</div>
						</Link>
					))
				) : (
					<div style={{ margin: "0px auto" }}>
						<p
							style={{
								color: "white",
								fontSize: 18,
							}}
						>
							No results found
						</p>
					</div>
				)
			) : null}
		</div>
	);
}