feat(content): 추천 오디오 탭을 추가한다
This commit is contained in:
64
SodaLive/Sources/V2/Main/Content/MainContentView.swift
Normal file
64
SodaLive/Sources/V2/Main/Content/MainContentView.swift
Normal file
@@ -0,0 +1,64 @@
|
||||
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 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user