feat(home): 홈 탭 shell을 연결한다
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import SwiftUI
|
||||
|
||||
struct MainHomeRecommendationView: View {
|
||||
let onTapLive: (Int) -> Void
|
||||
let onTapCreator: (Int) -> Void
|
||||
let onTapContent: (Int) -> Void
|
||||
let onTapCharacter: (Int) -> Void
|
||||
let onTapCommunity: (Int) -> Void
|
||||
|
||||
@StateObject private var viewModel = MainHomeRecommendationViewModel()
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.black
|
||||
.ignoresSafeArea()
|
||||
|
||||
if viewModel.isLoading && viewModel.recommendations == nil {
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if viewModel.recommendations == nil {
|
||||
viewModel.fetchRecommendations()
|
||||
}
|
||||
}
|
||||
.sodaToast(
|
||||
isPresented: $viewModel.isShowPopup,
|
||||
message: viewModel.errorMessage,
|
||||
autohideIn: 2
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct MainHomeRecommendationView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MainHomeRecommendationView(
|
||||
onTapLive: { _ in },
|
||||
onTapCreator: { _ in },
|
||||
onTapContent: { _ in },
|
||||
onTapCharacter: { _ in },
|
||||
onTapCommunity: { _ in }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user