68 lines
1.7 KiB
Swift
68 lines
1.7 KiB
Swift
//
|
|
// CanChargeStatusView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2023/08/11.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct CanChargeStatusView: View {
|
|
|
|
@StateObject var viewModel = CanStatusViewModel()
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
VStack(spacing: 13.3) {
|
|
ForEach(viewModel.chargeStatusItems, id: \.self) { item in
|
|
CanChargeStatusItemView(item: item)
|
|
}
|
|
}
|
|
|
|
if viewModel.isLoading {
|
|
LoadingView()
|
|
}
|
|
}
|
|
.onAppear {
|
|
viewModel.getCanChargeStatus()
|
|
}
|
|
}
|
|
}
|
|
|
|
struct CanChargeStatusItemView: View {
|
|
|
|
let item: GetCanChargeStatusResponseItem
|
|
|
|
var body: some View {
|
|
HStack(spacing: 0) {
|
|
VStack(alignment: .leading, spacing: 6.7) {
|
|
Text(item.canTitle)
|
|
.font(.custom(Font.medium.rawValue, size: 13.3))
|
|
.foregroundColor(Color(hex: "eeeeee"))
|
|
|
|
Text(item.date)
|
|
.font(.custom(Font.medium.rawValue, size: 12))
|
|
.foregroundColor(Color(hex: "777777"))
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Text(item.chargeMethod)
|
|
.font(.custom(Font.medium.rawValue, size: 13.3))
|
|
.foregroundColor(Color(hex: "eeeeee"))
|
|
}
|
|
.padding(.horizontal, 13.3)
|
|
.padding(.vertical, 16)
|
|
.background(Color(hex: "111111"))
|
|
.cornerRadius(16.7)
|
|
.padding(.horizontal, 13.3)
|
|
.frame(width: screenSize().width)
|
|
}
|
|
}
|
|
|
|
struct CanChargeStatusView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
CanChargeStatusView()
|
|
}
|
|
}
|