sodalive-ios/SodaLive/Sources/User/Login/LoginView.swift

85 lines
2.7 KiB
Swift

//
// LoginView.swift
// SodaLive
//
// Created by klaus on 2023/08/09.
//
import SwiftUI
import PopupView
struct LoginView: View {
@ObservedObject var viewModel = LoginViewModel()
var body: some View {
ZStack {
Color.black.ignoresSafeArea()
VStack(spacing: 0) {
HomeNavigationBar(title: "로그인") {}
Spacer()
UserTextField(
title: "이메일",
hint: "이메일 주소를 입력해 주세요",
isSecure: false,
variable: $viewModel.email,
keyboardType: .emailAddress
)
.padding(.horizontal, 26.7)
UserTextField(
title: "비밀번호",
hint: "비밀번호를 입력해 주세요",
isSecure: true,
variable: $viewModel.password,
isPasswordVisibleButton: true
)
.padding(.top, 33.3)
.padding(.horizontal, 26.7)
Button(action: { viewModel.login() }) {
Text("로그인")
.font(.custom(Font.bold.rawValue, size: 15))
.frame(width: screenSize().width - 26.6, height: 46.7)
.foregroundColor(.white)
.background(Color(hex: "9970ff"))
.cornerRadius(6.7)
}
.padding(.top, 40)
HStack(spacing: 10) {
Text("비밀번호 재설정")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "bbbbbb"))
.onTapGesture { AppState.shared.setAppStep(step: .findPassword) }
Text("|")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "bbbbbb"))
Text("회원가입")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "bbbbbb"))
.onTapGesture { AppState.shared.setAppStep(step: .signUp) }
}
.padding(.top, 40)
Spacer()
}
if viewModel.isLoading {
LoadingView()
}
}
}
}
struct LoginView_Previews: PreviewProvider {
static var previews: some View {
LoginView()
}
}