65 lines
1.8 KiB
Swift
65 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
struct MainContentView: View {
|
|
let onTapCanCharge: () -> Void
|
|
let onTapSearch: () -> Void
|
|
let onTapNotificationList: () -> Void
|
|
let onTapContent: (Int) -> Void
|
|
let onTapBanner: (AudioBannerResponse) -> Void
|
|
let onTapSeries: (Int) -> Void
|
|
|
|
@State private var selectedTab: MainContentTab = .recommendation
|
|
|
|
var body: some View {
|
|
VStack(spacing: 0) {
|
|
HomeTitleBar {
|
|
HStack(spacing: SodaSpacing.s14) {
|
|
Image("ic_bar_cash")
|
|
.onTapGesture { onTapCanCharge() }
|
|
|
|
Image("ic_bar_search")
|
|
.onTapGesture { onTapSearch() }
|
|
|
|
Image("ic_bar_bell")
|
|
.onTapGesture { onTapNotificationList() }
|
|
}
|
|
}
|
|
|
|
TextTabBar(
|
|
items: MainContentTab.allCases,
|
|
selectedItem: $selectedTab,
|
|
title: { $0.title }
|
|
)
|
|
|
|
tabContent
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
}
|
|
.background(Color.black.ignoresSafeArea())
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var tabContent: some View {
|
|
switch selectedTab {
|
|
case .recommendation:
|
|
MainContentRecommendationView(
|
|
onTapContent: onTapContent,
|
|
onTapBanner: onTapBanner,
|
|
onTapSeries: onTapSeries
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct MainContentView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
MainContentView(
|
|
onTapCanCharge: {},
|
|
onTapSearch: {},
|
|
onTapNotificationList: {},
|
|
onTapContent: { _ in },
|
|
onTapBanner: { _ in },
|
|
onTapSeries: { _ in }
|
|
)
|
|
}
|
|
}
|