86 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
		
			2.7 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: 65, height: 65)
 | 
						|
                    .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)
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
#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
 | 
						|
        )
 | 
						|
    )
 | 
						|
}
 |