Spaces:
Running
Running
File size: 1,125 Bytes
1f122c3 f62b8d3 1f122c3 4c34e70 1f122c3 f27679f 1f122c3 f62b8d3 1f122c3 4c34e70 1f122c3 f27679f 1f122c3 d160b97 4c34e70 1f122c3 f27679f 4c34e70 f27679f 1f122c3 |
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 |
import { cn } from "@/lib/utils"
import { VideoInfo } from "@/types"
import { VideoCard } from "../video-card"
export function VideoList({
videos,
layout = "grid",
className = "",
onSelect,
}: {
videos: VideoInfo[]
/**
* Layout mode
*
* This isn't necessarily based on screen size, it can also be:
* - based on the device type (eg. a smart TV)
* - a design choice for a particular page
*/
layout?: "grid" | "horizontal" | "vertical"
className?: string
onSelect?: (video: VideoInfo) => void
}) {
return (
<div
className={cn(
layout === "grid"
? `grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`
: layout === "vertical"
? `grid grid-cols-1 gap-2`
: `flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-4`,
className,
)}
>
{videos.map((video) => (
<VideoCard
key={video.id}
video={video}
className="w-full"
layout={layout === "vertical" ? "compact" : "normal"}
onSelect={onSelect}
/>
))}
</div>
)
} |