캔 내역, 캔 충전 페이지 추가
This commit is contained in:
67
SodaLive/Sources/MyPage/Can/Status/CanChargeStatusView.swift
Normal file
67
SodaLive/Sources/MyPage/Can/Status/CanChargeStatusView.swift
Normal file
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// 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()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user