-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoginView.swift
More file actions
62 lines (56 loc) · 1.93 KB
/
Copy pathLoginView.swift
File metadata and controls
62 lines (56 loc) · 1.93 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
58
59
60
61
62
//
// LoginView.swift
// DevLogPresentation
//
// Created by opfic on 12/30/24.
//
import SwiftUI
import ComposableArchitecture
import DevLogDomain
struct LoginView: View {
@Environment(\.colorScheme) var colorScheme
@Environment(\.sceneWidth) var sceneWidth
@State private var store: StoreOf<LoginFeature>
init(signInUseCase: SignInUseCase) {
self._store = State(initialValue: Store(
initialState: LoginFeature.State()
) {
LoginFeature()
} withDependencies: {
$0.signInUseCase = signInUseCase
})
}
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")) {
store.send(.tapSignInButton(.google))
}
LoginButton(logo: Image("Github"), text: String(localized: "login_github_sign_in")) {
store.send(.tapSignInButton(.github))
}
LoginButton(logo: Image("Apple"), text: String(localized: "login_apple_sign_in")) {
store.send(.tapSignInButton(.apple))
}
}
.padding(.bottom, 30)
Text(String(localized: "login_terms_notice"))
.font(.caption2)
.foregroundStyle(Color.gray)
.multilineTextAlignment(.center)
.padding(.vertical)
}
if store.isLoading {
LoadingView()
}
}
.alert($store.scope(state: \.alert, action: \.alert))
}
}