import React, { useRef } from "react"; import { ArrowLeft as ArrowLeftIcon, ArrowRight as ArrowRightIcon, } from "lucide-react"; import "../../assets/styles/listRow.css"; import ListItem, { ListItemProps } from "./ListItem"; interface ListRowProps { type: "stream" | "category" | "user"; title?: string; description?: string; items: ListItemProps[]; wrap: boolean; onClick: (itemName: string) => void; extraClasses?: string; children?: React.ReactNode; } // Row of entries const ListRow: React.FC = ({ title = "", description = "", items, wrap, onClick, extraClasses = "", children, }) => { const slider = useRef(null); const scrollAmount = window.innerWidth * 0.3; const slideRight = () => { if (!wrap && slider.current) { slider.current.scrollBy({ left: +scrollAmount, behavior: "smooth" }); } }; const slideLeft = () => { if (!wrap && slider.current) { slider.current.scrollBy({ left: -scrollAmount, behavior: "smooth" }); } }; return (

{title}

{description}

{!wrap && items.length > 4 && ( <> )}
{items.map((item) => ( item.type === "stream" && item.streamer ? onClick?.(item.streamer) : onClick?.(item.title) } /> ))}
{children}
); }; export default ListRow;