File size: 1,025 Bytes
f42b4a1
1185ec1
1f122c3
 
 
 
 
f62b8d3
1f122c3
 
 
 
 
f62b8d3
 
1f122c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b965e2b
1f122c3
 
 
 
 
 
 
 
f62b8d3
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
import { cn } from "@/lib/utils/cn"
import { ChannelInfo } from "@/types/general"

import { ChannelCard } from "../channel-card"

export function ChannelList({
  channels,
  onSelect,
  layout = "flex",
  className = "",
}: {
  channels: ChannelInfo[]

  onSelect?: (channel: ChannelInfo) => void

  /**
   * 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" | "flex"

  className?: string
}) {
  
  return (
    <div
      className={cn(
        layout === "grid"
          ? `grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7`
          : `flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-4`,
        className,
      )}
    >
    {channels.map((channel) => (
      <ChannelCard
        key={channel.id}
        channel={channel}
        onClick={onSelect}
        className=""
      />
    ))}
    </div>
  )
}