56 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  ContentDetailCreatorProfileView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 2023/08/11.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
import Kingfisher
 | 
						|
 | 
						|
struct ContentDetailCreatorProfileView: View {
 | 
						|
    
 | 
						|
    let creator: AudioContentCreator
 | 
						|
    let onClickFollow: (Int) -> Void
 | 
						|
    let showCreatorFollowNotifyDialog: (Int) -> Void
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        HStack(spacing: 0) {
 | 
						|
            KFImage(URL(string: creator.profileImageUrl))
 | 
						|
                .cancelOnDisappear(true)
 | 
						|
                .downsampling(
 | 
						|
                    size: CGSize(
 | 
						|
                        width: 26.7,
 | 
						|
                        height: 26.7
 | 
						|
                    )
 | 
						|
                )
 | 
						|
                .resizable()
 | 
						|
                .frame(width: 26.7, height: 26.7)
 | 
						|
                .clipShape(Circle())
 | 
						|
            
 | 
						|
            Text(creator.nickname)
 | 
						|
                .font(.custom(Font.medium.rawValue, size: 12))
 | 
						|
                .foregroundColor(Color.gray77)
 | 
						|
                .padding(.horizontal, 5.3)
 | 
						|
            
 | 
						|
            Spacer()
 | 
						|
            
 | 
						|
            if creator.creatorId != UserDefaults.int(forKey: .userId) {
 | 
						|
                Image(creator.isFollow ?
 | 
						|
                      creator.isNotify ? 
 | 
						|
                      "btn_following_big" : 
 | 
						|
                        "btn_following_no_alarm_big" :
 | 
						|
                        "btn_follow_big"
 | 
						|
                )
 | 
						|
                .onTapGesture {
 | 
						|
                    if creator.isFollowing {
 | 
						|
                        showCreatorFollowNotifyDialog(creator.creatorId)
 | 
						|
                    } else {
 | 
						|
                        onClickFollow(creator.creatorId)
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |