// // ContentDetailCommentView.swift // SodaLive // // Created by klaus on 2023/08/13. // import SwiftUI import Kingfisher struct ContentDetailCommentView: View { let commentCount: Int let commentList: [GetAudioContentCommentListItem] let registerComment: (String) -> Void @State private var comment = "" var body: some View { VStack(alignment: .leading, spacing: 10.3) { HStack(spacing: 5.3) { Text("댓글") .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(.white) Text("\(commentCount)") .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color(hex: "909090")) Spacer() } HStack(spacing: 8) { KFImage( URL( string: commentCount > 0 ? commentList[0].profileUrl : UserDefaults.string(forKey: .profileImage) ) ) .cancelOnDisappear(true) .downsampling(size: CGSize(width: 33.3, height: 33.3)) .resizable() .frame(width: 33.3, height: 33.3) .clipShape(Circle()) if commentCount > 0 { Text(commentList[0].comment) .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color(hex: "bbbbbb")) .lineLimit(1) .padding(.leading, 3) } else { HStack(spacing: 0) { TextField("댓글을 입력해 보세요.", text: $comment) .autocapitalization(.none) .disableAutocorrection(true) .font(.custom(Font.medium.rawValue, size: 13.3)) .foregroundColor(Color(hex: "eeeeee")) .accentColor(Color(hex: "3bb9f1")) .keyboardType(.default) .padding(.horizontal, 13.3) Spacer() Image("btn_message_send") .resizable() .frame(width: 35, height: 35) .padding(6.7) .onTapGesture { hideKeyboard() registerComment(comment) } } .background(Color(hex: "232323")) .cornerRadius(10) .overlay( RoundedRectangle(cornerRadius: 10) .strokeBorder(lineWidth: 1) .foregroundColor(Color(hex: "3bb9f1")) ) } Spacer() } } } }