콘텐츠 메인 - Api 분리
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ContentMainMyStashView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentMainMyStashView: View {
|
||||
|
||||
@StateObject private var viewModel = ContentMainMyStashViewModel()
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
if !viewModel.orderList.isEmpty {
|
||||
VStack(alignment: .leading, spacing: 13.3) {
|
||||
HStack(spacing: 0) {
|
||||
Text("내 보관함")
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("전체보기")
|
||||
.font(.custom(Font.light.rawValue, size: 11.3))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.onTapGesture {
|
||||
AppState.shared.setAppStep(step: .orderListAll)
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
LazyHStack(alignment: .top, spacing: 13.3) {
|
||||
ForEach(0..<viewModel.orderList.count, id: \.self) { index in
|
||||
let item = viewModel.orderList[index]
|
||||
ContentMainItemView(item: item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.isLoading {
|
||||
ActivityIndicatorView()
|
||||
.frame(width: 100, height: 100)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.onAppear {
|
||||
viewModel.getOrderList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentMainMyStashView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentMainMyStashView()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user