2021-09-18 20:36:42 +00:00
|
|
|
import Defaults
|
|
|
|
import SwiftUI
|
|
|
|
|
2021-10-21 23:29:10 +00:00
|
|
|
struct HorizontalCells: View {
|
|
|
|
var items = [ContentItem]()
|
2021-09-18 20:36:42 +00:00
|
|
|
|
|
|
|
var body: some View {
|
2021-09-30 16:53:26 +00:00
|
|
|
ScrollView(.horizontal, showsIndicators: false) {
|
|
|
|
LazyHStack(spacing: 20) {
|
2021-10-21 23:29:10 +00:00
|
|
|
ForEach(items) { item in
|
|
|
|
ContentItemView(item: item)
|
2021-09-30 16:53:26 +00:00
|
|
|
.environment(\.horizontalCells, true)
|
|
|
|
#if os(tvOS)
|
|
|
|
.frame(width: 580)
|
|
|
|
.padding(.trailing, 20)
|
|
|
|
.padding(.bottom, 40)
|
|
|
|
#else
|
2021-10-24 22:26:25 +00:00
|
|
|
.frame(width: 285)
|
2021-09-30 16:53:26 +00:00
|
|
|
#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)
|
2021-10-05 20:20:09 +00:00
|
|
|
.padding(.vertical, 10)
|
2021-09-30 16:53:26 +00:00
|
|
|
#endif
|
2021-09-18 20:36:42 +00:00
|
|
|
}
|
|
|
|
#if os(tvOS)
|
|
|
|
.frame(height: 560)
|
|
|
|
#else
|
2021-11-04 23:25:51 +00:00
|
|
|
.frame(height: 290)
|
2021-09-18 20:36:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
.edgesIgnoringSafeArea(.horizontal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-21 23:29:10 +00:00
|
|
|
struct HorizontalCells_Previews: PreviewProvider {
|
2021-09-18 20:36:42 +00:00
|
|
|
static var previews: some View {
|
2021-10-21 23:29:10 +00:00
|
|
|
HorizontalCells(items: ContentItem.array(of: Video.allFixtures))
|
2021-09-29 11:45:00 +00:00
|
|
|
.injectFixtureEnvironmentObjects()
|
2021-09-18 20:36:42 +00:00
|
|
|
}
|
|
|
|
}
|