aboutsummaryrefslogtreecommitdiff
path: root/src/app/movies/components/searchFormatter.jsx
blob: ded60220e3e207a5905dadc757cf8af1838397ea (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
"use server";

import { Card, CardHeader, CardBody } from "@nextui-org/react";
import Image from "next/image";
import Link from "next/link";
import styles from "../../page.module.css";

const MovieSearchFormatter = async (data) => {
	return (
		<section
			className={`flex items-center overflow-auto pb-2 mb-2 ${styles.ScrollBarAdjuster}`}
		>
			{data &&
				data.results.map((item, index) => {
					if (item.poster_path) {
						return (
							<Link
								key={index}
								href={`/movies/${item.id}`}
								aria-label="anime redirection links"
								className="flex flex-col items-center mx-1 "
							>
								<Card className="overflow-hidden" isPressable>
									<CardBody>
										<Image
											alt="Searched Movie Poster"
											src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=https://image.tmdb.org/t/p/original${item.poster_path}`}
											width={190}
											height={120}
											className="rounded-md h-64"
											priority
										/>
									</CardBody>
									<CardHeader>
										<h4
											className={`antialiased  text-small text-center uppercase w-44 overflow-hidden whitespace-nowrap text-ellipsis `}
										>
											{item.original_title}
										</h4>
									</CardHeader>
								</Card>
							</Link>
						);
					}
				})}
		</section>
	);
};

export default MovieSearchFormatter;