// // CreatorCommunityItemView.swift // SodaLive // // Created by klaus on 2023/12/14. // import SwiftUI import Kingfisher struct CreatorCommunityItemView: View { let item: GetCommunityPostListResponse var body: some View { VStack(alignment: .leading, spacing: 8) { HStack(spacing: 11) { KFImage(URL(string: item.creatorProfileUrl)) .resizable() .frame(width: 40, height: 40) .clipShape(Circle()) Text(item.creatorNickname) .font(.custom(Font.medium.rawValue, size: 13.3)) .foregroundColor(Color(hex: "eeeeee")) Spacer() Text(item.date) .font(.custom(Font.light.rawValue, size: 13.3)) .foregroundColor(Color(hex: "777777")) } HStack(spacing: 0) { Text(item.content) .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color(hex: "bbbbbb")) .fixedSize(horizontal: false, vertical: true) .lineLimit(3) Spacer() if let imageUrl = item.imageUrl { KFImage(URL(string: imageUrl)) .resizable() .frame(width: 53.3, height: 53.3) .cornerRadius(4.7) } else { Rectangle() .foregroundColor(Color(hex: "222222").opacity(0)) .frame(width: 53.3, height: 53.3) } } HStack(spacing: 13.3) { HStack(spacing: 6) { Image("ic_heart_777") .resizable() .frame(width: 13.3, height: 13.3) Text("\(item.likeCount)") .font(.custom(Font.medium.rawValue, size: 11)) .foregroundColor(Color(hex: "777777")) } HStack(spacing: 6) { Image("ic_message_square_777") .resizable() .frame(width: 13.3, height: 13.3) Text("\(item.commentCount)") .font(.custom(Font.medium.rawValue, size: 11)) .foregroundColor(Color(hex: "777777")) } } } .frame(maxWidth: .infinity, alignment: .leading) .padding(13.3) .background(Color(hex: "222222")) .cornerRadius(11) } } struct CreatorCommunityItemView_Previews: PreviewProvider { static var previews: some View { CreatorCommunityItemView( item: GetCommunityPostListResponse( postId: 1, creatorNickname: "민하나", creatorProfileUrl: "https://test-cf.sodalive.net/profile/default-profile.png", imageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", content: "안녕하세요", date: "3일전", isCommentAvailable: false, isAdult: false, isLike: false, likeCount: 10, commentCount: 0, firstComment: nil ) ) } }