-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoginView.swift
More file actions
57 lines (52 loc) · 1.88 KB
/
Copy pathLoginView.swift
File metadata and controls
57 lines (52 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// LoginView.swift
// DevLog
//
// Created by opfic on 12/30/24.
//
import SwiftUI
struct LoginView: View {
@Environment(\.colorScheme) var colorScheme
@Environment(\.sceneWidth) var sceneWidth
@State var viewModel: LoginViewModel
var body: some View {
ZStack {
VStack {
Spacer()
Image("Primary")
.resizable()
.scaledToFit()
.frame(width: sceneWidth / 5)
Spacer()
VStack(spacing: 20) {
LoginButton(logo: Image("Google"), text: String(localized: "login_google_sign_in")) {
viewModel.send(.tapSignInButton(.google))
}
LoginButton(logo: Image("Github"), text: String(localized: "login_github_sign_in")) {
viewModel.send(.tapSignInButton(.github))
}
LoginButton(logo: Image("Apple"), text: String(localized: "login_apple_sign_in")) {
viewModel.send(.tapSignInButton(.apple))
}
}
.padding(.bottom, 30)
Text(String(localized: "login_terms_notice"))
.font(.caption2)
.foregroundStyle(Color.gray)
.multilineTextAlignment(.center)
.padding(.vertical)
}
if viewModel.state.isLoading {
LoadingView()
}
}
.alert(viewModel.state.alertTitle, isPresented: Binding(
get: { viewModel.state.showAlert },
set: { viewModel.send(.setAlert($0)) }
)) {
Button(String(localized: "common_close"), role: .cancel) { }
} message: {
Text(viewModel.state.alertMessage)
}
}
}