73 lines
2.5 KiB
Swift
73 lines
2.5 KiB
Swift
//
|
|
// LiveRoomDonationChatItemView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2023/08/14.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Kingfisher
|
|
|
|
struct LiveRoomDonationChatItemView: View {
|
|
|
|
let chatMessage: LiveRoomDonationChat
|
|
|
|
var body: some View {
|
|
HStack(spacing: 13.3) {
|
|
ZStack(alignment: .bottomTrailing) {
|
|
KFImage(URL(string: chatMessage.profileUrl))
|
|
.resizable()
|
|
.scaledToFill()
|
|
.frame(width: 33.3, height: 33.3, alignment: .top)
|
|
.clipped()
|
|
.cornerRadius(23.3)
|
|
|
|
Image("ic_can")
|
|
.resizable()
|
|
.frame(width: 20, height: 20)
|
|
}
|
|
|
|
VStack(alignment: .leading, spacing: 6.7) {
|
|
HStack(spacing: 0) {
|
|
Text(chatMessage.nickname)
|
|
.font(.system(size: 12))
|
|
.foregroundColor(.white)
|
|
|
|
Text("님이")
|
|
.font(.system(size: 12, weight: .light))
|
|
.foregroundColor(.white)
|
|
}
|
|
|
|
HStack(spacing: 0) {
|
|
Text("\(chatMessage.can)캔")
|
|
.font(.system(size: 15))
|
|
.foregroundColor(Color(hex: "fdca2f"))
|
|
|
|
Text("을 후원하셨습니다.")
|
|
.font(.system(size: 15))
|
|
.foregroundColor(.white)
|
|
}
|
|
|
|
if !chatMessage.donationMessage.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
|
Text("\"\(chatMessage.donationMessage)\"")
|
|
.font(.system(size: 15))
|
|
.foregroundColor(.white)
|
|
}
|
|
}
|
|
}
|
|
.padding(13)
|
|
.frame(width: screenSize().width - 86, alignment: .leading)
|
|
.background(
|
|
chatMessage.can >= 10000 ? Color(hex: "c25264") :
|
|
chatMessage.can >= 5000 ? Color(hex: "d85e37").opacity(0.9) :
|
|
chatMessage.can >= 1000 ? Color(hex: "d38c38").opacity(0.9) :
|
|
chatMessage.can >= 500 ? Color(hex: "59548f").opacity(0.9) :
|
|
chatMessage.can >= 100 ? Color(hex: "4d6aa4").opacity(0.9) :
|
|
chatMessage.can >= 50 ? Color(hex: "2d7390").opacity(0.9) :
|
|
Color(hex: "548f7d").opacity(0.9)
|
|
)
|
|
.cornerRadius(10)
|
|
.padding(.leading, 20)
|
|
}
|
|
}
|