feat(content): 추천 오디오 탭을 추가한다
This commit is contained in:
@@ -13,27 +13,12 @@ struct MainHomeBannerSection: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if !items.isEmpty {
|
||||
BannerCarousel(items: carouselItems) { item in
|
||||
guard let banner = banner(for: item) else { return }
|
||||
onTapBanner(banner)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var carouselItems: [BannerCarouselItem] {
|
||||
items.enumerated().map { index, item in
|
||||
BannerCarouselItem(
|
||||
id: fallbackId(for: item, index: index),
|
||||
imageUrl: item.imageUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private func banner(for carouselItem: BannerCarouselItem) -> RecommendationBannerResponse? {
|
||||
items.enumerated().first { index, item in
|
||||
fallbackId(for: item, index: index) == carouselItem.id
|
||||
}?.element
|
||||
BannerCarouselSection(
|
||||
items: items,
|
||||
id: fallbackId,
|
||||
imageUrl: { $0.imageUrl },
|
||||
action: onTapBanner
|
||||
)
|
||||
}
|
||||
|
||||
private func fallbackId(for item: RecommendationBannerResponse, index: Int) -> String {
|
||||
|
||||
Reference in New Issue
Block a user