Files
sodalive-ios/SodaLive/Sources/Explorer/Profile/UserProfileDonationView.swift
Yu Sung 280e424385 커스텀 폰트 pretendard-medium, gmarket-medium를 사용하고 있던 것을 appFont 모디
파이어를 사용하여 한국어는 pretendard, 그 외에는 시스템 폰트를 사용하도록 수정
2026-01-23 03:09:20 +09:00

93 lines
3.8 KiB
Swift

//
// UserProfileDonationView.swift
// SodaLive
//
// Created by klaus on 2023/08/11.
//
import SwiftUI
import Kingfisher
struct UserProfileDonationView: View {
let userId: Int
let donationRankingResponse: [UserDonationRankingResponse]
let rankingCrawns = ["ic_crown_1", "ic_crown_2", "ic_crown_3"]
let rankingColors = [
[Color(hex: "ffdc00"), Color(hex: "ffb600")],
[Color(hex: "ffffff"), Color(hex: "9f9f9f")],
[Color(hex: "e6a77a"), Color(hex: "c67e4a")],
[Color(hex: "ffffff").opacity(0), Color(hex: "ffffff").opacity(0)]
]
var body: some View {
VStack(alignment: .leading, spacing: 14) {
HStack(spacing: 0) {
Text("후원랭킹")
.appFont(size: 26, weight: .bold)
.foregroundColor(Color.white)
Spacer()
Text("전체보기")
.font(.custom(Font.preLight.rawValue, size: 14))
.foregroundColor(Color(hex: "78909C"))
.onTapGesture {
AppState.shared.setAppStep(step: .userProfileDonationAll(userId: userId))
}
}
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 13.3) {
ForEach(0..<donationRankingResponse.count, id: \.self) { index in
let item = donationRankingResponse[index]
VStack(spacing: 6.7) {
ZStack {
KFImage(URL(string: item.profileImage))
.cancelOnDisappear(true)
.downsampling(
size: CGSize(
width: 70,
height: 70
)
)
.resizable()
.scaledToFill()
.frame(width: 70, height: 70, alignment: .top)
.clipShape(Circle())
.overlay(
Circle()
.stroke(
AngularGradient(colors: rankingColors[index < 4 ? index : 3], center: .center),
lineWidth: 3
)
)
if index < 3 {
VStack(alignment: .trailing, spacing: 0) {
Spacer()
Image(rankingCrawns[index])
.resizable()
.frame(width: 25, height: 25)
}
.frame(width: 73, height: 73, alignment: .trailing)
}
}
.frame(width: 73, height: 73)
Text(item.nickname)
.appFont(size: 12, weight: .medium)
.foregroundColor(.grayee)
.frame(width: 63)
.lineLimit(1)
}
}
}
.padding(.horizontal, 24)
}
}
}
}