-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHorizontalCards.jsx
45 lines (39 loc) · 1.51 KB
/
HorizontalCards.jsx
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 React from "react";
import Dropdown from "./Dropdown"
const HorizontalCards = ({ data }) => { // Accept data as a prop
return (
<div className="w-full p-5">
<div className="mb-5 flex justify-between">
<h1 className="text-3xl font-semibold text-zinc-400">
Trending</h1>
<Dropdown title="Filter" options={["tv","movie","all"]} />
</div>
<div className="w-[100%] flex overflow-x-auto">
{data.map((d, i) => (
<div key={i} className="min-w-[15%] bg-zinc-900 mr-5">
<img
className="w-full h-[45%] object-cover"
src={`https://image.tmdb.org/t/p/original/${
d.backdrop_path || d.poster_path
}`} // Removed extra comma
alt={d.title || d.name || "Movie/Show Image"}
/>
<div className="text-white">
<h1 className="mt-3 text-xl font-semibold text-white">
{d.title ||
d.name ||
d.original_name ||
d.original_title}
</h1>
<p className="text-white">
{d.overview ? `${d.overview.slice(0,50)}...` : "No description available."} {/* Handle missing overview */}
<span className="text-zinc-500"> more</span>
</p>
</div>
</div>
))}
</div>
</div>
)
};
export default HorizontalCards;