11"use client" ;
22
33import { Button } from "@/components/ui/button" ;
4+ import { cn } from "@/lib/utils" ;
45import { motion } from "framer-motion" ;
5- import { ChevronRight } from "lucide-react" ;
6+ import { ChevronRight , Play } from "lucide-react" ;
67import { useRef } from "react" ;
78
8- type FieldCard = {
9+ type MediaCard = {
910 id : number ;
10- image : string ;
11+ media : string ;
12+ type : "image" | "video" ;
1113 title : string ;
1214 description : string ;
15+ date : string ;
1316} ;
1417
15- const cards : FieldCard [ ] = [
18+ const cards : MediaCard [ ] = [
1619 {
1720 id : 1 ,
18- image : "/homepage/captain.jpg" ,
19- title : "Skipper Shines" ,
20- description : "Our captain led the charge with a steady 60 runs." ,
21+ media : "/latestfromarena/captains.jpg" ,
22+ type : "image" ,
23+ title : "Marquee Captains together" ,
24+ description :
25+ "Marquee Captains together - Ishan Pandey of Mixmandu with the Captain of Himalayan Titanz" ,
26+ date : "Sept 5, 2025" ,
2127 } ,
2228 {
2329 id : 2 ,
24- image : "/homepage/captain.jpg" ,
25- title : "Skipper Shines" ,
26- description : "Our captain led the charge with a steady 60 runs." ,
27- } ,
28- {
29- id : 3 ,
30- image : "/homepage/captain.jpg" ,
31- title : "Skipper Shines" ,
32- description : "Our captain led the charge with a steady 60 runs." ,
33- } ,
34- {
35- id : 4 ,
36- image : "/homepage/captain.jpg" ,
37- title : "Skipper Shines" ,
38- description : "Our captain led the charge with a steady 60 runs." ,
39- } ,
40- {
41- id : 5 ,
42- image : "/homepage/captain.jpg" ,
43- title : "Skipper Shines" ,
44- description : "Our captain led the charge with a steady 60 runs." ,
30+ media : "/latestfromarena/batting-field-raw.mp4" ,
31+ type : "video" ,
32+ title : "Mixmandu - Himalayan Titanz - Encouter" ,
33+ description :
34+ "Exciting highlights from the recent match featuring spectacular catches and boundaries" ,
35+ date : "Sept 5, 2025" ,
4536 } ,
4637] ;
4738
48- export default function FieldCardCarousel ( ) {
39+ export default function MediaCarousel ( ) {
4940 const carouselRef = useRef < HTMLDivElement > ( null ) ;
5041
5142 const scrollNext = ( ) => {
@@ -64,7 +55,9 @@ export default function FieldCardCarousel() {
6455 { /* Carousel */ }
6556 < motion . div
6657 ref = { carouselRef }
67- className = "flex overflow-x-auto py-6 no-scrollbar space-x-10 pl-16 md:pl-24 pr-4"
58+ className = { cn (
59+ "flex overflow-x-auto md:justify-center py-6 no-scrollbar space-x-10 pl-16 md:pl-24 pr-4"
60+ ) }
6861 whileTap = { { cursor : "grabbing" } }
6962 >
7063 { cards . map ( ( card ) => (
@@ -74,20 +67,69 @@ export default function FieldCardCarousel() {
7467 whileHover = { { scale : 1.05 } }
7568 >
7669 < div className = "h-[470px] relative rounded-2xl border-none shadow-muted overflow-hidden" >
77- < img
78- src = { card . image }
79- alt = { card . title }
80- className = "h-full rounded-2xl absolute w-full object-cover"
81- />
82- < div
83- className = "absolute inset-0 pointer-events-none"
84- style = { {
85- background : `linear-gradient(to top, #51A176 0%, transparent 40%)` ,
86- } }
87- />
88- < div className = "p-4 bottom-0 absolute" >
89- < h3 className = "text-lg font-bold" > { card . title } </ h3 >
90- < p className = "text-sm" > { card . description } </ p >
70+ { card . type === "image" ? (
71+ // Image Display
72+ < >
73+ < img
74+ src = { card . media }
75+ alt = { card . title }
76+ className = "h-full rounded-2xl absolute w-full object-cover"
77+ />
78+ < div
79+ className = "absolute inset-0 pointer-events-none"
80+ style = { {
81+ background : `linear-gradient(to top, #51A176 0%, transparent 40%)` ,
82+ } }
83+ />
84+ </ >
85+ ) : (
86+ // Video Display
87+ < >
88+ < video
89+ className = "h-full rounded-2xl absolute w-full object-cover cursor-pointer"
90+ muted
91+ loop
92+ playsInline
93+ autoPlay
94+ >
95+ < source src = { card . media } type = "video/mp4" />
96+ Your browser does not support the video tag.
97+ </ video >
98+
99+ < div
100+ className = "absolute inset-0 pointer-events-none"
101+ style = { {
102+ background : `linear-gradient(to top, #51A176 0%, transparent 40%)` ,
103+ } }
104+ />
105+ </ >
106+ ) }
107+
108+ { /* Content Overlay */ }
109+ < div className = "p-4 top-[62%] absolute z-10" >
110+ < h3 className = "text-lg font-bold text-white" > { card . title } </ h3 >
111+ < p className = "text-sm text-white text-opacity-90" >
112+ { card . description }
113+ </ p >
114+
115+ < div
116+ className = { cn (
117+ "flex items-center mt-1 w-full" ,
118+ card . type === "video" ? "justify-between" : "justify-end"
119+ ) }
120+ >
121+ { card . type === "video" && (
122+ < div className = "flex items-center text-xs text-white text-opacity-75" >
123+ < Play className = "w-3 h-3 mr-1" />
124+ < span > Video Content</ span >
125+ </ div >
126+ ) }
127+ { card . date && (
128+ < p className = "text-[10px] text-white text-right" >
129+ { card . date }
130+ </ p >
131+ ) }
132+ </ div >
91133 </ div >
92134 </ div >
93135 </ motion . div >
0 commit comments