108 lines
3.6 KiB
Swift
108 lines
3.6 KiB
Swift
//
|
|
// 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.grayee)
|
|
|
|
Spacer()
|
|
|
|
Text(item.date)
|
|
.font(.custom(Font.light.rawValue, size: 13.3))
|
|
.foregroundColor(Color.gray77)
|
|
}
|
|
|
|
HStack(spacing: 0) {
|
|
Text(item.content)
|
|
.font(.custom(Font.medium.rawValue, size: 12))
|
|
.foregroundColor(Color.graybb)
|
|
.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)
|
|
.blur(radius: item.existOrdered || item.price <= 0 ? 0 : 15)
|
|
} else {
|
|
Rectangle()
|
|
.foregroundColor(Color.gray22.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.gray77)
|
|
}
|
|
|
|
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.gray77)
|
|
}
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding(13.3)
|
|
.background(Color.gray22)
|
|
.cornerRadius(11)
|
|
}
|
|
}
|
|
|
|
struct CreatorCommunityItemView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
CreatorCommunityItemView(
|
|
item: GetCommunityPostListResponse(
|
|
postId: 1,
|
|
creatorId: 1,
|
|
creatorNickname: "민하나",
|
|
creatorProfileUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
|
imageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
|
content: "안녕하세요",
|
|
price: 10,
|
|
date: "3일전",
|
|
isCommentAvailable: false,
|
|
isAdult: false,
|
|
isLike: false,
|
|
existOrdered: false,
|
|
likeCount: 10,
|
|
commentCount: 0,
|
|
firstComment: nil
|
|
)
|
|
)
|
|
}
|
|
}
|