Files
sodalive-ios/SodaLive/Sources/Home/HomeCreatorRankingItemView.swift
Yu Sung 4c3fa0fbb5 feat: 메인 홈 - 크리에이터 랭킹, 추천 채널
- 터치시 크리에이터 채널로 이동하는 기능 추가
2025-07-14 18:47:21 +09:00

89 lines
2.8 KiB
Swift

//
// HomeCreatorRankingItemView.swift
// SodaLive
//
// Created by klaus on 7/11/25.
//
import SwiftUI
import Kingfisher
struct HomeCreatorRankingItemView: View {
let rank: Int
let item: GetExplorerSectionCreatorResponse
let crowns = ["rank_1", "rank_2", "rank_3"]
var body: some View {
ZStack(alignment: .topLeading) {
VStack(spacing: 0) {
KFImage(URL(string: item.profileImageUrl))
.cancelOnDisappear(true)
.resizable()
.frame(width: 56, height: 56)
.clipShape(Circle())
Text(item.nickname)
.font(.custom(Font.preRegular.rawValue, size: 18))
.foregroundColor(.white)
.padding(.top, 8)
Text("팔로워")
.font(.custom(Font.preBold.rawValue, size: 14))
.foregroundColor(Color(hex: "78909C"))
.padding(.top, 12)
Text("\(item.followerCount)")
.font(.custom(Font.preRegular.rawValue, size: 14))
.foregroundColor(Color(hex: "78909C"))
.padding(.top, 4)
}
.frame(width: 133, height: 188)
.background(
LinearGradient(
gradient: Gradient(colors: [Color(hex: "5ACDE1"), Color(hex: "2A339D")]),
startPoint: .topLeading,
endPoint: .bottom
)
)
.cornerRadius(16)
.overlay {
RoundedRectangle(cornerRadius: 16)
.strokeBorder(
LinearGradient(
gradient: Gradient(colors: [Color(hex: "9AE2F6"), .white.opacity(0)]),
startPoint: .top,
endPoint: .bottom
),
lineWidth: 1
)
}
.padding(.top, 20)
if rank <= 3 {
Image(crowns[rank - 1])
.resizable()
.frame(width: 40, height: 40)
.padding(.leading, 10)
}
}
.onTapGesture {
AppState.shared.setAppStep(step: .creatorDetail(userId: item.id))
}
}
}
#Preview {
HomeCreatorRankingItemView(
rank: 1,
item: GetExplorerSectionCreatorResponse(
id: 1,
nickname: "유빈ASMR",
tags: "",
profileImageUrl: "https://cf.sodalive.net/profile/34806/34806-profile-49db6b45-bb1e-4dc7-917e-1a614a853f5f-4232-1752158072656",
followerCount: 1000
)
)
}