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)
|
|
.appFont(size: 12, weight: .medium)
|
|
.foregroundColor(Color.gray77)
|
|
.padding(.horizontal, 5.3)
|
|
|
|
Spacer()
|
|
|
|
if creator.creatorId != UserDefaults.int(forKey: .userId) {
|
|
let asset = FollowButtonImageAsset(
|
|
type: creator.isFollow
|
|
? (creator.isNotify ? .following : .followingNoAlarm)
|
|
: .follow
|
|
)
|
|
asset.imageView()
|
|
.onTapGesture {
|
|
if creator.isFollowing {
|
|
showCreatorFollowNotifyDialog(creator.creatorId)
|
|
} else {
|
|
onClickFollow(creator.creatorId)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|