"use client";
import { useState, useCallback } from "react";
import Image from "next/image";
import { FunZoneItem } from "@/lib/types";
import { Eye, Gamepad2 } from "lucide-react";
interface FunZoneCarouselProps {
items: FunZoneItem[];
}
const FunZoneCarousel = ({ items }: FunZoneCarouselProps) => {
const [activeIndex, setActiveIndex] = useState(0);
const active = items[activeIndex];
const handleTabKeyDown = useCallback(
(e: React.KeyboardEvent) => {
if (e.key === "ArrowRight") {
e.preventDefault();
setActiveIndex((i) => (i + 1) % items.length);
} else if (e.key === "ArrowLeft") {
e.preventDefault();
setActiveIndex((i) => (i - 1 + items.length) % items.length);
}
},
[items.length],
);
return (
{/* Spotlight card */}
{/* Screenshot area */}
{active.thumbnail ? (
) : (
)}
{/* Info bar */}
{active.name}
{active.tagline}
{/* Dots */}
{items.map((item, index) => (
{/* Tab bar */}
{items.map((item, index) => (
))}
);
};
export default FunZoneCarousel;