Skip to content

Commit

Permalink
Fix incorrect form section margin
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentTreguier committed Aug 26, 2024
1 parent b478274 commit 59cc78f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
24 changes: 11 additions & 13 deletions Fyreplace/Views/Screens/LoginScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,25 @@ struct LoginScreen: View, LoginScreenProtocol {
.disabled(!canSubmit)
.matchedGeometryEffect(id: "submit", in: namespace)

let cancelButton = Button(role: .cancel) {
withAnimation {
isWaitingForRandomCode = false
randomCode = ""
}
} label: {
let cancelButton = Button(role: .cancel, action: cancel) {
Text("Cancel").padding(.horizontal)
}
.disabled(!isWaitingForRandomCode)

let footer = isWaitingForRandomCode
? VStack {
if isWaitingForRandomCode {
Text("Login.Help.RandomCode")
}
}
: nil

DynamicForm {
Section(
header: LogoHeader(text: "Login.Header", namespace: namespace),
footer: VStack {
if isWaitingForRandomCode {
Text("Login.Help.RandomCode")
}
}
footer: footer
) {
EnvironmentPicker(namespace: namespace)
.disabled(isWaitingForRandomCode)
EnvironmentPicker(namespace: namespace).disabled(isWaitingForRandomCode)

TextField("Login.Identifier", text: $identifier, prompt: Text("Login.Identifier.Prompt"))
.autocorrectionDisabled()
Expand Down
7 changes: 7 additions & 0 deletions Fyreplace/Views/Screens/LoginScreenProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ extension LoginScreenProtocol {
}
}

func cancel() {
withAnimation {
isWaitingForRandomCode = false
randomCode = ""
}
}

func sendEmail() async throws -> Bool {
let response = try await client.createNewToken(body: .json(.init(identifier: identifier)))

Expand Down

0 comments on commit 59cc78f

Please sign in to comment.