2021-09-19 02:06:42 +05:30
|
|
|
import Defaults
|
|
|
|
import SwiftUI
|
|
|
|
|
2021-10-22 04:59:10 +05:30
|
|
|
struct HorizontalCells: View {
|
|
|
|
var items = [ContentItem]()
|
2021-09-19 02:06:42 +05:30
|
|
|
|
|
|
|
var body: some View {
|
2021-09-30 22:23:26 +05:30
|
|
|
ScrollView(.horizontal, showsIndicators: false) {
|
|
|
|
LazyHStack(spacing: 20) {
|
2021-10-22 04:59:10 +05:30
|
|
|
ForEach(items) { item in
|
|
|
|
ContentItemView(item: item)
|
2021-09-30 22:23:26 +05:30
|
|
|
.environment(\.horizontalCells, true)
|
|
|
|
#if os(tvOS)
|
|
|
|
.frame(width: 580)
|
|
|
|
.padding(.trailing, 20)
|
|
|
|
.padding(.bottom, 40)
|
|
|
|
#else
|
2021-10-25 03:56:25 +05:30
|
|
|
.frame(width: 285)
|
2021-09-30 22:23:26 +05:30
|
|
|
#endif
|
2021-09-30 04:59:18 +05:30
|
|
|
}
|
2021-09-19 02:06:42 +05:30
|
|
|
}
|
2021-09-30 22:23:26 +05:30
|
|
|
#if os(tvOS)
|
|
|
|
.padding(.horizontal, 40)
|
|
|
|
.padding(.vertical, 30)
|
|
|
|
#else
|
|
|
|
.padding(.horizontal, 15)
|
2021-10-06 01:50:09 +05:30
|
|
|
.padding(.vertical, 10)
|
2021-09-30 22:23:26 +05:30
|
|
|
#endif
|
2021-09-19 02:06:42 +05:30
|
|
|
}
|
|
|
|
#if os(tvOS)
|
|
|
|
.frame(height: 560)
|
|
|
|
#else
|
2021-10-06 01:50:09 +05:30
|
|
|
.frame(height: 250)
|
2021-09-19 02:06:42 +05:30
|
|
|
#endif
|
|
|
|
|
|
|
|
.edgesIgnoringSafeArea(.horizontal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-22 04:59:10 +05:30
|
|
|
struct HorizontalCells_Previews: PreviewProvider {
|
2021-09-19 02:06:42 +05:30
|
|
|
static var previews: some View {
|
2021-10-22 04:59:10 +05:30
|
|
|
HorizontalCells(items: ContentItem.array(of: Video.allFixtures))
|
2021-09-29 17:15:00 +05:30
|
|
|
.injectFixtureEnvironmentObjects()
|
2021-09-19 02:06:42 +05:30
|
|
|
}
|
|
|
|
}
|