feat(home): 응원 크리에이터 섹션을 연결한다
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import SwiftUI
|
||||
|
||||
struct MainHomeCheerCreatorSection: View {
|
||||
let items: [HomeCreatorItem]
|
||||
let isFollowAllCompleted: Bool
|
||||
let isFollowAllLoading: Bool
|
||||
let onTapCreator: (Int) -> Void
|
||||
let onTapFollowAll: () -> Void
|
||||
|
||||
init(
|
||||
items: [HomeCreatorItem],
|
||||
isFollowAllCompleted: Bool = false,
|
||||
isFollowAllLoading: Bool = false,
|
||||
onTapCreator: @escaping (Int) -> Void = { _ in },
|
||||
onTapFollowAll: @escaping () -> Void = {}
|
||||
) {
|
||||
self.items = items
|
||||
self.isFollowAllCompleted = isFollowAllCompleted
|
||||
self.isFollowAllLoading = isFollowAllLoading
|
||||
self.onTapCreator = onTapCreator
|
||||
self.onTapFollowAll = onTapFollowAll
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if !items.isEmpty {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s14) {
|
||||
SectionTitle(title: I18n.HomeRecommendation.cheerCreatorSectionTitle)
|
||||
|
||||
MainHomeCreatorGroupSection(
|
||||
title: I18n.HomeRecommendation.cheerCreatorSectionTitle,
|
||||
showTitle: false,
|
||||
creators: items,
|
||||
isFollowAllCompleted: isFollowAllCompleted,
|
||||
isFollowAllLoading: isFollowAllLoading,
|
||||
onTapCreator: onTapCreator,
|
||||
onTapFollowAll: onTapFollowAll
|
||||
)
|
||||
.padding(.horizontal, SodaSpacing.s14)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainHomeCheerCreatorSection_Previews: PreviewProvider {
|
||||
private static let previewImageUrl = "https://picsum.photos/200/200"
|
||||
|
||||
static var previews: some View {
|
||||
MainHomeCheerCreatorSection(
|
||||
items: (1...8).map {
|
||||
HomeCreatorItem(
|
||||
creatorId: $0,
|
||||
creatorNickname: "크리에이터이름",
|
||||
creatorProfileImage: previewImageUrl
|
||||
)
|
||||
}
|
||||
)
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
.background(Color.black)
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user