콘텐츠 리스트 - 가격, 시간 추가

This commit is contained in:
Yu Sung 2024-02-14 16:11:06 +09:00
parent 7d0c472885
commit 20cce36c16
3 changed files with 53 additions and 6 deletions

View File

@ -19,11 +19,54 @@ struct ContentNewAllItemView: View {
ContentDetailView(contentId: item.contentId) ContentDetailView(contentId: item.contentId)
} label: { } label: {
VStack(alignment: .leading, spacing: 8) { VStack(alignment: .leading, spacing: 8) {
KFImage(URL(string: item.coverImageUrl)) ZStack(alignment: .bottom) {
.resizable() KFImage(URL(string: item.coverImageUrl))
.scaledToFill() .resizable()
.frame(width: width, height: width, alignment: .top) .scaledToFill()
.cornerRadius(2.7) .frame(width: width, height: width, alignment: .top)
.cornerRadius(2.7)
VStack(spacing: 0) {
Spacer()
HStack(spacing: 0) {
HStack(spacing: 2) {
if item.price > 0 {
Image("ic_card_can_gray")
Text("\(item.price)")
.font(.custom(Font.medium.rawValue, size: 8.3))
.foregroundColor(Color.white)
} else {
Text("무료")
.font(.custom(Font.medium.rawValue, size: 8.3))
.foregroundColor(Color.white)
}
}
.padding(3)
.background(Color(hex: "333333").opacity(0.7))
.cornerRadius(10)
.padding(.leading, 2.7)
.padding(.bottom, 2.7)
Spacer()
HStack(spacing: 2) {
Image("ic_card_time_small_gray")
Text(item.duration)
.font(.custom(Font.medium.rawValue, size: 8.3))
.foregroundColor(Color.white)
}
.padding(3)
.background(Color(hex: "333333").opacity(0.7))
.cornerRadius(10)
.padding(.trailing, 2.7)
.padding(.bottom, 2.7)
}
}
}
.frame(width: width, height: width)
Text(item.title) Text(item.title)
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))

View File

@ -59,7 +59,9 @@ struct ContentMainItemView_Previews: PreviewProvider {
title: "ㅓ처랴햐햫햐햐", title: "ㅓ처랴햐햫햐햐",
creatorId: 8, creatorId: 8,
creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
creatorNickname: "유저2" creatorNickname: "유저2",
price: 10,
duration: "00:00:30"
) )
) )
} }

View File

@ -48,6 +48,8 @@ struct GetAudioContentMainItem: Decodable {
let creatorId: Int let creatorId: Int
let creatorProfileImageUrl: String let creatorProfileImageUrl: String
let creatorNickname: String let creatorNickname: String
let price: Int
let duration: String
} }
struct GetAudioContentCurationResponse: Decodable { struct GetAudioContentCurationResponse: Decodable {