Skip to content

Commit 2bbc9e3

Browse files
chore: improve UI for password prompt
1 parent 0a5962f commit 2bbc9e3

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed
Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import FirebaseCore
12
import SwiftUI
23

34
struct PasswordPromptSheet {
@@ -9,26 +10,47 @@ struct PasswordPromptSheet {
910
extension PasswordPromptSheet: View {
1011
var body: some View {
1112
VStack(spacing: 20) {
12-
SecureField(authService.string.passwordInputLabel, text: $password)
13-
.textFieldStyle(.roundedBorder)
13+
Text(authService.string.confirmPasswordInputLabel)
14+
.font(.largeTitle)
15+
.fontWeight(.bold)
1416
.padding()
1517

16-
HStack {
17-
Button(authService.string.cancelButtonLabel) {
18-
coordinator.cancel()
19-
}
20-
Spacer()
21-
Button(authService.string.okButtonLabel) {
18+
Divider()
19+
20+
LabeledContent {
21+
TextField(authService.string.passwordInputLabel, text: $password)
22+
.textInputAutocapitalization(.never)
23+
.disableAutocorrection(true)
24+
.submitLabel(.next)
25+
} label: {
26+
Image(systemName: "lock")
27+
}.padding(.vertical, 10)
28+
.background(Divider(), alignment: .bottom)
29+
.padding(.bottom, 4)
30+
31+
Button(action: {
32+
Task {
2233
coordinator.submit(password: password)
2334
}
24-
.disabled(password.isEmpty)
35+
}) {
36+
Text(authService.string.okButtonLabel)
37+
.padding(.vertical, 8)
38+
.frame(maxWidth: .infinity)
39+
}
40+
.disabled(password.isEmpty)
41+
.padding([.top, .bottom, .horizontal], 8)
42+
.frame(maxWidth: .infinity)
43+
.buttonStyle(.borderedProminent)
44+
45+
Button(authService.string.cancelButtonLabel) {
46+
coordinator.cancel()
2547
}
26-
.padding(.horizontal)
2748
}
2849
.padding()
2950
}
3051
}
3152

3253
#Preview {
33-
PasswordPromptSheet(coordinator: PasswordPromptCoordinator())
54+
FirebaseOptions.dummyConfigurationForPreview()
55+
return PasswordPromptSheet(coordinator: PasswordPromptCoordinator()).environment(AuthService())
3456
}

0 commit comments

Comments
 (0)