mirror of
https://github.com/yattee/yattee.git
synced 2026-10-28 15:37:17 +00:00
Fix macOS related video carousel chrome
This commit is contained in:
@@ -176,6 +176,28 @@ extension ExpandedPlayerSheet {
|
|||||||
/// Horizontal carousel of recommended video cards.
|
/// Horizontal carousel of recommended video cards.
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func recommendedVideosCarousel(videos: [Video]) -> some View {
|
private func recommendedVideosCarousel(videos: [Video]) -> some View {
|
||||||
|
#if os(macOS)
|
||||||
|
ScrollView(.horizontal) {
|
||||||
|
LazyHStack(spacing: 0) {
|
||||||
|
ForEach(Array(videos.enumerated()), id: \.element.id) { index, video in
|
||||||
|
Button {
|
||||||
|
playRecommendedVideo(video)
|
||||||
|
} label: {
|
||||||
|
videoPreviewCard(video: video)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.containerRelativeFrame(.horizontal)
|
||||||
|
.id(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.scrollTargetLayout()
|
||||||
|
}
|
||||||
|
.scrollPosition(id: $recommendedScrollPosition)
|
||||||
|
.scrollTargetBehavior(.paging)
|
||||||
|
.scrollIndicators(.hidden)
|
||||||
|
.frame(height: 100)
|
||||||
|
#else
|
||||||
TabView(selection: Binding(
|
TabView(selection: Binding(
|
||||||
get: { recommendedScrollPosition ?? 0 },
|
get: { recommendedScrollPosition ?? 0 },
|
||||||
set: { recommendedScrollPosition = $0 }
|
set: { recommendedScrollPosition = $0 }
|
||||||
@@ -190,10 +212,9 @@ extension ExpandedPlayerSheet {
|
|||||||
.tag(index)
|
.tag(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
.tabViewStyle(.page(indexDisplayMode: .never))
|
.tabViewStyle(.page(indexDisplayMode: .never))
|
||||||
#endif
|
|
||||||
.frame(height: 100)
|
.frame(height: 100)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reusable horizontal video preview card (same style as autoplay countdown).
|
/// Reusable horizontal video preview card (same style as autoplay countdown).
|
||||||
|
|||||||
Reference in New Issue
Block a user