Files
sodalive-ios/SodaLive/Sources/Dialog/LiveRoomPasswordDialog.swift
Yu Sung 280e424385 커스텀 폰트 pretendard-medium, gmarket-medium를 사용하고 있던 것을 appFont 모디
파이어를 사용하여 한국어는 pretendard, 그 외에는 시스템 폰트를 사용하도록 수정
2026-01-23 03:09:20 +09:00

131 lines
5.3 KiB
Swift

//
// LiveRoomPasswordDialog.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import SwiftUI
struct LiveRoomPasswordDialog: View {
@Binding var isShowing: Bool
let can: Int
let confirmAction: (String) -> Void
@State private var password = ""
@StateObject var keyboardHandler = KeyboardHandler()
var body: some View {
GeometryReader { geo in
ZStack {
Color.black
.opacity(0.5)
.frame(width: geo.size.width, height: geo.size.height)
VStack(spacing: 0) {
Text("비밀번호 입력")
.appFont(size: 18.3, weight: .bold)
.foregroundColor(Color(hex: "bbbbbb"))
.padding(.top, 40)
Text("비공개 라이브의 입장 비밀번호를\n입력해 주세요.")
.appFont(size: 13, weight: .medium)
.foregroundColor(Color(hex: "bbbbbb"))
.multilineTextAlignment(.center)
.padding(.top, 12)
.padding(.horizontal, 13.3)
UserTextField(
title: "비밀번호",
hint: "비밀번호를 입력해 주세요",
isSecure: false,
variable: $password,
keyboardType: .numberPad
)
.padding(.horizontal, 13.3)
.padding(.top, 13.3)
HStack(spacing: 13.3) {
Text("취소")
.appFont(size: 15.3, weight: .bold)
.foregroundColor(Color(hex: "3bb9f1"))
.padding(.vertical, 16)
.frame(width: (geo.size.width - 66.7) / 3)
.background(Color(hex: "13181b"))
.cornerRadius(8)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(Color(hex: "3bb9f1"), lineWidth: 1)
)
.onTapGesture {
isShowing = false
}
if can > 0 {
HStack(spacing: 0) {
Text("\(can)")
.appFont(size: 15.3, weight: .bold)
.foregroundColor(Color(hex: "ffffff"))
Image("ic_can")
.resizable()
.frame(width: 20, height: 20)
Text("으로 입장")
.appFont(size: 15.3, weight: .bold)
.foregroundColor(Color(hex: "ffffff"))
}
.padding(.vertical, 16)
.frame(width: (geo.size.width - 66.7) * 2 / 3)
.background(Color(hex: "3bb9f1"))
.cornerRadius(8)
.onTapGesture {
if password.trimmingCharacters(in: .whitespaces).isEmpty {
confirmAction("")
} else {
confirmAction(password)
}
isShowing = false
}
} else {
Text("입장하기")
.appFont(size: 15.3, weight: .bold)
.foregroundColor(Color(hex: "ffffff"))
.padding(.vertical, 16)
.frame(width: (geo.size.width - 66.7) * 2 / 3)
.background(Color(hex: "3bb9f1"))
.cornerRadius(8)
.onTapGesture {
if password.trimmingCharacters(in: .whitespaces).isEmpty {
confirmAction("")
} else {
confirmAction(password)
}
isShowing = false
}
}
}
.padding(.top, 45)
.padding(.bottom, 16.7)
}
.frame(width: geo.size.width - 26.7, alignment: .center)
.background(Color(hex: "222222"))
.cornerRadius(10)
.offset(y: 0 - (keyboardHandler.keyboardHeight / 3))
}
}
}
}
struct LiveRoomPasswordDialog_Previews: PreviewProvider {
static var previews: some View {
LiveRoomPasswordDialog(
isShowing: .constant(true),
can: 10,
confirmAction: { _ in }
)
}
}