import { cn } from "@/lib/utils/cn" import { MediaDisplayLayout, MediaInfo } from "@/types/general" import { TrackCard } from "../track-card" import { VideoCard } from "../video-card" export function MediaList({ items, type = "video", layout = "grid", className = "", onSelect, selectedId, }: { items: MediaInfo[] /** * 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?: MediaDisplayLayout /** * Content type * * Used to change the way we display elements */ type?: "video" | "track" className?: string onSelect?: (media: MediaInfo) => void selectedId?: string }) { return (
{items.map((media, i) => { const Component = type === "track" ? TrackCard : VideoCard return ( ) })}
) }