yattee/Shared/Videos/VideosCellsHorizontal.swift

51 lines
1.4 KiB
Swift
Raw Normal View History

2021-09-18 20:36:42 +00:00
import Defaults
import SwiftUI
struct VideosCellsHorizontal: View {
#if os(iOS)
@Environment(\.verticalSizeClass) private var verticalSizeClass
#endif
var videos = [Video]()
var body: some View {
2021-09-30 16:53:26 +00:00
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 20) {
ForEach(videos) { video in
VideoView(video: video)
.environment(\.horizontalCells, true)
#if os(tvOS)
.frame(width: 580)
.padding(.trailing, 20)
.padding(.bottom, 40)
#else
.frame(width: 300)
#endif
2021-09-29 23:29:18 +00:00
}
2021-09-18 20:36:42 +00:00
}
2021-09-30 16:53:26 +00:00
#if os(tvOS)
.padding(.horizontal, 40)
.padding(.vertical, 30)
#else
.padding(.horizontal, 15)
.padding(.vertical, 10)
2021-09-30 16:53:26 +00:00
#endif
2021-09-18 20:36:42 +00:00
}
2021-09-30 16:53:26 +00:00
.id(UUID())
2021-09-18 20:36:42 +00:00
#if os(tvOS)
.frame(height: 560)
#else
.frame(height: 250)
2021-09-18 20:36:42 +00:00
#endif
.edgesIgnoringSafeArea(.horizontal)
}
}
struct VideoCellsHorizontal_Previews: PreviewProvider {
static var previews: some View {
VideosCellsHorizontal(videos: Video.allFixtures)
2021-09-29 11:45:00 +00:00
.injectFixtureEnvironmentObjects()
2021-09-18 20:36:42 +00:00
}
}