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,38 +95,14 @@ struct VideoBanner: View {
.lineLimit(1)
#if os(tvOS)
progressView
extraAttributes
#endif
}
.foregroundColor(.secondary)
HStack(spacing: 16) {
if let video {
if let date = video.publishedDate {
HStack(spacing: 2) {
Text(date)
.allowsTightening(true)
}
}
if video.views > 0 {
HStack(spacing: 2) {
Image(systemName: "eye")
Text(video.viewsCount!)
}
}
}
if timeInfo {
Spacer()
timeLabel
.layoutPriority(1)
}
}
.font(.caption)
.lineLimit(1)
.foregroundColor(.secondary)
#if !os(tvOS)
extraAttributes
#endif
}
.frame(maxWidth: .infinity, alignment: .leading)
.frame(maxHeight: .infinity)
@ -148,6 +124,40 @@ struct VideoBanner: View {
.id(id ?? video?.videoID ?? video?.id)
}
private var extraAttributes: some View {
HStack(spacing: 16) {
if let video {
if let date = video.publishedDate {
HStack(spacing: 2) {
Text(date)
.allowsTightening(true)
}
}
if video.views > 0 {
HStack(spacing: 2) {
Image(systemName: "eye")
Text(video.viewsCount!)
}
}
}
if timeInfo {
Spacer()
#if os(tvOS)
progressView
#endif
timeLabel
.layoutPriority(1)
}
}
.font(.caption)
.lineLimit(1)
.foregroundColor(.secondary)
}
@ViewBuilder private var smallThumbnail: some View {
ZStack(alignment: .bottomLeading) {
ZStack {