2021-06-28 15:27:53 +00:00
|
|
|
import Defaults
|
2021-06-23 22:19:58 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct VideosCellsView: View {
|
2021-06-28 15:27:53 +00:00
|
|
|
@Default(.tabSelection) var tabSelection
|
|
|
|
|
2021-06-23 22:19:58 +00:00
|
|
|
@State private var columns: Int
|
|
|
|
|
|
|
|
init(videos: [Video], columns: Int = 3) {
|
|
|
|
self.videos = videos
|
|
|
|
self.columns = columns
|
|
|
|
}
|
|
|
|
|
|
|
|
var videos = [Video]()
|
|
|
|
|
|
|
|
var body: some View {
|
2021-06-26 09:39:35 +00:00
|
|
|
ScrollView(.vertical, showsIndicators: false) {
|
2021-06-23 22:19:58 +00:00
|
|
|
LazyVGrid(columns: items, spacing: 10) {
|
|
|
|
ForEach(videos) { video in
|
|
|
|
VideoCellView(video: video)
|
2021-06-28 15:27:53 +00:00
|
|
|
.contextMenu { VideoContextMenuView(video: video) }
|
2021-06-23 22:19:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.padding()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var items: [GridItem] {
|
|
|
|
Array(repeating: .init(.fixed(600)), count: columns)
|
|
|
|
}
|
|
|
|
}
|