Video banner layout fixes

This commit is contained in:
Arkadiusz Fal 2022-12-13 10:09:21 +01:00
parent 57b2276f36
commit d38a507be5

View File

@ -95,11 +95,36 @@ struct VideoBanner: View {
.lineLimit(1)
#if os(tvOS)
progressView
extraAttributes
#endif
}
.foregroundColor(.secondary)
#if !os(tvOS)
extraAttributes
#endif
}
.frame(maxWidth: .infinity, alignment: .leading)
.frame(maxHeight: .infinity)
#if os(tvOS)
.padding(.vertical)
#endif
}
.fixedSize(horizontal: false, vertical: true)
.contentShape(Rectangle())
#if os(tvOS)
.buttonStyle(.card)
#else
.buttonStyle(.plain)
#endif
#if os(tvOS)
.padding(.trailing, 10)
#endif
.opacity(contentOpacity)
.id(id ?? video?.videoID ?? video?.id)
}
private var extraAttributes: some View {
HStack(spacing: 16) {
if let video {
if let date = video.publishedDate {
@ -120,6 +145,10 @@ struct VideoBanner: View {
if timeInfo {
Spacer()
#if os(tvOS)
progressView
#endif
timeLabel
.layoutPriority(1)
}
@ -128,25 +157,6 @@ struct VideoBanner: View {
.lineLimit(1)
.foregroundColor(.secondary)
}
.frame(maxWidth: .infinity, alignment: .leading)
.frame(maxHeight: .infinity)
#if os(tvOS)
.padding(.vertical)
#endif
}
.fixedSize(horizontal: false, vertical: true)
.contentShape(Rectangle())
#if os(tvOS)
.buttonStyle(.card)
#else
.buttonStyle(.plain)
#endif
#if os(tvOS)
.padding(.trailing, 10)
#endif
.opacity(contentOpacity)
.id(id ?? video?.videoID ?? video?.id)
}
@ViewBuilder private var smallThumbnail: some View {
ZStack(alignment: .bottomLeading) {