Files
sodalive-ios/SodaLive/Sources/V2/Gift/Send/Components/GiftSenderFormView.swift
T

54 lines
2.0 KiB
Swift

import SwiftUI
struct GiftSenderFormView: View {
@Binding var name: String
@Binding var phoneNumber: String
@Binding var zipCode: String
@Binding var address: String
@Binding var addressDetail: String
var body: some View {
VStack(alignment: .leading, spacing: SodaSpacing.s20) {
VStack(alignment: .leading, spacing: SodaSpacing.s4) {
Text("보내는 사람")
.appFont(.heading3)
.foregroundColor(.white)
Text("발송 확인 외의 용도로 사용하지 않으며, 전달이 완료되면 파기됩니다")
.appFont(.caption3)
.foregroundColor(.gray500)
.fixedSize(horizontal: false, vertical: true)
}
field("이름", helper: "택배 발송 시 이름과 동일하게 적어주세요") {
GiftContactTextField(text: $name, rule: .name)
}
field("휴대폰 번호", helper: "문제 발생 시 연락이 가능한 번호를 입력해 주세요") {
GiftContactTextField(text: $phoneNumber, rule: .phoneNumber)
}
SodaAddressInputView(zipCode: $zipCode, address: $address, addressDetail: $addressDetail)
}
}
private func field<Content: View>(
_ title: String,
helper: String,
@ViewBuilder content: () -> Content
) -> some View {
VStack(alignment: .leading, spacing: SodaSpacing.s4) {
Text(title)
.appFont(.body5)
.foregroundColor(.grayee)
content()
.appFont(.body3)
.foregroundColor(.white)
.padding(SodaSpacing.s14)
.background(Color.gray900)
.cornerRadius(SodaRadius.r14)
.accessibilityLabel(title)
Text(helper)
.appFont(.caption3)
.foregroundColor(.gray500)
.fixedSize(horizontal: false, vertical: true)
}
}
}