feat(creator): 커뮤니티 게시글 상세를 연결한다
This commit is contained in:
@@ -4,6 +4,7 @@ struct CreatorChannelCommunityGridItem: View {
|
||||
let post: CreatorChannelCommunityPostItem
|
||||
let isOwnPost: Bool
|
||||
let onTapPurchase: () -> Void
|
||||
let onTapDetail: () -> Void
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { proxy in
|
||||
@@ -14,20 +15,10 @@ struct CreatorChannelCommunityGridItem: View {
|
||||
.overlay(paidPriceOverlay)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
} else if let imageUrl = post.imageUrl, !imageUrl.isEmpty {
|
||||
DownsampledKFImage(url: URL(string: imageUrl), size: CGSize(width: proxy.size.width, height: proxy.size.width))
|
||||
.frame(width: proxy.size.width, height: proxy.size.width)
|
||||
.aspectRatio(1, contentMode: .fill)
|
||||
.clipped()
|
||||
} else {
|
||||
Color.gray900
|
||||
|
||||
Text(fallbackText)
|
||||
.appFont(size: 12, weight: .medium)
|
||||
.foregroundColor(.white)
|
||||
.multilineTextAlignment(.center)
|
||||
.lineLimit(3)
|
||||
.padding(SodaSpacing.s8)
|
||||
tileContent(proxy: proxy)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture(perform: onTapDetail)
|
||||
}
|
||||
}
|
||||
.frame(width: proxy.size.width, height: proxy.size.width)
|
||||
@@ -47,6 +38,27 @@ struct CreatorChannelCommunityGridItem: View {
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func tileContent(proxy: GeometryProxy) -> some View {
|
||||
if let imageUrl = post.imageUrl, !imageUrl.isEmpty {
|
||||
DownsampledKFImage(url: URL(string: imageUrl), size: CGSize(width: proxy.size.width, height: proxy.size.width))
|
||||
.frame(width: proxy.size.width, height: proxy.size.width)
|
||||
.aspectRatio(1, contentMode: .fill)
|
||||
.clipped()
|
||||
} else {
|
||||
ZStack {
|
||||
Color.gray900
|
||||
|
||||
Text(fallbackText)
|
||||
.appFont(size: 12, weight: .medium)
|
||||
.foregroundColor(.white)
|
||||
.multilineTextAlignment(.center)
|
||||
.lineLimit(3)
|
||||
.padding(SodaSpacing.s8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var paidPriceOverlay: some View {
|
||||
VStack(spacing: SodaSpacing.s4) {
|
||||
Image("ic_new_community_lock")
|
||||
|
||||
Reference in New Issue
Block a user