62 lines
2.0 KiB
Swift
62 lines
2.0 KiB
Swift
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)
|
|
}
|
|
}
|