sodalive-ios/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentItemView...

90 lines
3.3 KiB
Swift

//
// AudioContentCommentItemView.swift
// SodaLive
//
// Created by klaus on 2023/08/13.
//
import SwiftUI
import Kingfisher
struct AudioContentCommentItemView: View {
let comment: GetAudioContentCommentListItem
let isReplyComment: Bool
var body: some View {
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 6.7) {
KFImage(URL(string: comment.profileUrl))
.resizable()
.frame(width: 40, height: 40)
.clipShape(Circle())
VStack(alignment: .leading, spacing: 0) {
Text(comment.nickname)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
Text(comment.date)
.font(.custom(Font.medium.rawValue, size: 10.3))
.foregroundColor(Color(hex: "525252"))
.padding(.top, 4)
}
Spacer()
}
if comment.donationCan > 0 {
HStack(spacing: 3) {
Image("ic_can")
.resizable()
.frame(width: 13.3, height: 13.3)
Text("\(comment.donationCan)")
.font(.custom(Font.bold.rawValue, size: 12))
.foregroundColor(.white)
}
.padding(.horizontal, 6.7)
.padding(.vertical, 2.7)
.background(
comment.donationCan >= 100000 ? Color(hex: "973a3a") :
comment.donationCan >= 50000 ? Color(hex: "d85e37") :
comment.donationCan >= 10000 ? Color(hex: "d38c38") :
comment.donationCan >= 5000 ? Color(hex: "59548f") :
comment.donationCan >= 1000 ? Color(hex: "4d6aa4") :
comment.donationCan >= 500 ? Color(hex: "2d7390") :
Color(hex: "548f7d")
)
.cornerRadius(10.7)
.padding(.leading, 46.7)
.padding(.bottom, 5)
}
HStack(spacing: 0) {
VStack(alignment: .leading, spacing: 13.3) {
Text(comment.comment)
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "777777"))
.fixedSize(horizontal: false, vertical: true)
.padding(.top, comment.donationCan > 0 ? 0 : 13.3)
if !isReplyComment {
Text(comment.replyCount > 0 ? "답글 \(comment.replyCount)" : "답글 쓰기")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "9970ff"))
}
}
Spacer()
}
.padding(.leading, 46.7)
Rectangle()
.foregroundColor(Color(hex: "595959"))
.frame(height: 0.5)
.padding(.top, 16.7)
}
}
}