sodalive-ios/SodaLive/Sources/MyPage/CanCardView.swift

84 lines
2.6 KiB
Swift

//
// CanCardView.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import SwiftUI
struct CanCardView: View {
let data: MyPageResponse
let refresh: () -> Void
var body: some View {
HStack(spacing: 0) {
Button(action: { AppState.shared.setAppStep(step: .canStatus(refresh: refresh)) }) {
HStack(spacing: 6.7) {
Text("\(data.chargeCan + data.rewardCan)")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
Image("ic_can")
.resizable()
.frame(width: 20, height: 20)
Image("ic_forward")
.resizable()
.frame(width: 20, height: 20)
}
}
Spacer()
Button(action: { AppState.shared.setAppStep(step: .canCharge(refresh: refresh)) }) {
HStack(spacing: 7) {
Image("ic_coin_w")
.resizable()
.frame(width: 26.7, height: 26.7)
Text("충전")
.font(.custom(Font.bold.rawValue, size: 12))
.foregroundColor(Color(hex: "b38fff"))
}
.padding(.horizontal, 11.3)
.padding(.vertical, 7)
.overlay(
RoundedRectangle(cornerRadius: CGFloat(16.7))
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "b38fff"))
)
.cornerRadius(16.7)
}
}
.padding(.horizontal, 13.3)
.padding(.vertical, 16.7)
.background(Color(hex: "222222"))
.cornerRadius(16.7)
}
}
struct CanCardView_Previews: PreviewProvider {
static var previews: some View {
CanCardView(
data: MyPageResponse(
nickname: "완다 막시모프",
profileUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
chargeCan: 0,
rewardCan: 150,
youtubeUrl: "",
instagramUrl: "",
websiteUrl: "",
blogUrl: "",
liveReservationCount: 0,
isAuth: false,
orderList: GetAudioContentOrderListResponse(
totalCount: 0,
items: []
)
),
refresh: {}
)
}
}