Fix images layout

This commit is contained in:
Arkadiusz Fal
2022-09-02 01:19:30 +02:00
parent 79512d4cbf
commit f7dd88a6cb
5 changed files with 83 additions and 84 deletions

View File

@@ -73,35 +73,30 @@ struct VideoBanner: View {
@ViewBuilder private var smallThumbnail: some View {
let url = video?.thumbnailURL(quality: .medium)
if #available(iOS 15, macOS 12, *) {
CachedAsyncImage(url: url) { image in
image
.resizable()
} placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor"))
}
#if os(tvOS)
.frame(width: thumbnailWidth, height: 140)
.mask(RoundedRectangle(cornerRadius: 12))
#else
.frame(width: thumbnailWidth, height: 60)
.mask(RoundedRectangle(cornerRadius: 6))
#endif
} else {
WebImage(url: url)
.resizable()
.placeholder {
ProgressView()
Group {
if #available(iOS 15, macOS 12, *) {
CachedAsyncImage(url: url) { image in
image
.resizable()
} placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor"))
}
.indicator(.activity)
#if os(tvOS)
.frame(width: thumbnailWidth, height: 140)
.mask(RoundedRectangle(cornerRadius: 12))
#else
.frame(width: thumbnailWidth, height: 60)
.mask(RoundedRectangle(cornerRadius: 6))
#endif
} else {
WebImage(url: url)
.resizable()
.placeholder {
ProgressView()
}
.indicator(.activity)
}
}
#if os(tvOS)
.frame(width: thumbnailWidth, height: 140)
.mask(RoundedRectangle(cornerRadius: 12))
#else
.frame(width: thumbnailWidth, height: 60)
.mask(RoundedRectangle(cornerRadius: 6))
#endif
}
private var thumbnailWidth: Double {

View File

@@ -429,9 +429,6 @@ struct VideoCell: View {
} placeholder: {
Rectangle().foregroundColor(Color("PlaceholderColor"))
}
#if os(tvOS)
.frame(minHeight: 320)
#endif
} else {
WebImage(url: url)
.resizable()
@@ -443,12 +440,11 @@ struct VideoCell: View {
guard let url = url else { return }
thumbnails.insertUnloadable(url)
}
#if os(tvOS)
.frame(minHeight: 320)
#endif
}
}
#if os(tvOS)
.frame(minHeight: 320)
#endif
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
.modifier(AspectRatioModifier())
}