79 lines
2.3 KiB
Swift
79 lines
2.3 KiB
Swift
import SwiftUI
|
|
|
|
struct MainContentSeriesThumbnailCard: View {
|
|
let item: MainContentSeriesResponse
|
|
let width: CGFloat
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: SodaSpacing.s8) {
|
|
thumbnail
|
|
|
|
labelContent
|
|
}
|
|
.frame(width: width, alignment: .leading)
|
|
}
|
|
|
|
private var thumbnail: some View {
|
|
ZStack(alignment: .topLeading) {
|
|
DownsampledKFImage(
|
|
url: item.coverImageUrl.flatMap(URL.init(string:)),
|
|
size: CGSize(width: width, height: width * 1.41)
|
|
)
|
|
.background(Color.gray800)
|
|
|
|
if item.isOriginal {
|
|
originalTag
|
|
}
|
|
|
|
HStack(spacing: 0) {
|
|
Spacer(minLength: 0)
|
|
|
|
if item.isAdult {
|
|
CreatorChannelAudioAdultTag()
|
|
.padding(.top, SodaSpacing.s6)
|
|
.padding(.trailing, SodaSpacing.s6)
|
|
}
|
|
}
|
|
}
|
|
.frame(width: width, height: width * 1.41)
|
|
.clipShape(RoundedRectangle(cornerRadius: SodaSpacing.s14, style: .continuous))
|
|
}
|
|
|
|
private var originalTag: some View {
|
|
HStack(spacing: SodaSpacing.s4) {
|
|
Image("ic_series_original")
|
|
.resizable()
|
|
.scaledToFit()
|
|
.frame(width: 14, height: 14)
|
|
|
|
Image("img_new_only")
|
|
.resizable()
|
|
.scaledToFit()
|
|
.frame(height: 14)
|
|
}
|
|
.padding(.horizontal, SodaSpacing.s8)
|
|
.padding(.vertical, 5)
|
|
.background(Color.gray900)
|
|
}
|
|
|
|
private var labelContent: some View {
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
Text(item.title)
|
|
.appFont(size: 16, weight: .bold)
|
|
.foregroundColor(Color.white)
|
|
.lineLimit(1)
|
|
.truncationMode(.tail)
|
|
|
|
Text(item.creatorNickname)
|
|
.appFont(size: 12, weight: .medium)
|
|
.foregroundColor(Color.gray500)
|
|
.lineLimit(1)
|
|
.truncationMode(.tail)
|
|
}
|
|
.frame(width: width - (SodaSpacing.s4 * 2), alignment: .leading)
|
|
.padding(.horizontal, SodaSpacing.s4)
|
|
.frame(width: width, alignment: .leading)
|
|
}
|
|
}
|
|
|