mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
41 lines
779 B
Swift
41 lines
779 B
Swift
|
|
import SwiftUI
|
|||
|
|
|
|||
|
|
struct ToggleAuthFlowButton: View {
|
|||
|
|
let authFlow: AuthFlow
|
|||
|
|
let action: () -> Void
|
|||
|
|
|
|||
|
|
var buttonTitle: String {
|
|||
|
|
switch authFlow {
|
|||
|
|
case .signIn:
|
|||
|
|
return "Don’t have an account? "
|
|||
|
|
case .signUp:
|
|||
|
|
return "Already have an account? "
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var buttonTitleSuffix: String {
|
|||
|
|
switch authFlow {
|
|||
|
|
case .signIn:
|
|||
|
|
return "Sign Up"
|
|||
|
|
case .signUp:
|
|||
|
|
return "Log In"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var body: some View {
|
|||
|
|
Button(
|
|||
|
|
action: action,
|
|||
|
|
label: {
|
|||
|
|
Text(buttonTitle)
|
|||
|
|
.font(.appFootnote)
|
|||
|
|
.foregroundColor(.appGrayText)
|
|||
|
|
+ Text(buttonTitleSuffix)
|
|||
|
|
.underline()
|
|||
|
|
.font(.appFootnote)
|
|||
|
|
.foregroundColor(.red)
|
|||
|
|
}
|
|||
|
|
)
|
|||
|
|
.buttonStyle(PlainButtonStyle())
|
|||
|
|
}
|
|||
|
|
}
|