Use border instead of shadow for validation results (#540)

This commit is contained in:
Nathan Mattes 2022-11-09 17:07:06 +01:00
parent 187bda7ef4
commit 367e759f50
1 changed files with 12 additions and 7 deletions

View File

@ -168,22 +168,27 @@ struct MastodonRegisterView: View {
func body(content: Content) -> some View {
ZStack {
let shadowColor: Color = {
let borderColor: Color = {
switch validateState {
case .empty: return .black.opacity(0.125)
case .invalid: return Color(Asset.Colors.TextField.invalid.color)
case .valid: return Color(Asset.Colors.TextField.valid.color)
case .empty: return Color(Asset.Scene.Onboarding.textFieldBackground.color)
case .invalid: return Color(Asset.Colors.TextField.invalid.color)
case .valid: return Color(Asset.Scene.Onboarding.textFieldBackground.color)
}
}()
//TODO: @zeitschlag Replace shadow with border
Color(Asset.Scene.Onboarding.textFieldBackground.color)
.cornerRadius(10)
.shadow(color: shadowColor, radius: 1, x: 0, y: 2)
.animation(.easeInOut, value: validateState)
.shadow(color: .black.opacity(0.125), radius: 1, x: 0, y: 2)
content
.padding()
.background(Color(Asset.Scene.Onboarding.textFieldBackground.color))
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(borderColor, lineWidth: 1)
.animation(.easeInOut, value: validateState)
)
}
}
}