Validation Failure/Success updated to handle dark mode

This commit is contained in:
Lukas Korba 2022-03-15 16:33:54 +01:00
parent b45d1a0dba
commit f58b17e6e1
10 changed files with 60 additions and 29 deletions

View File

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.173",
"green" : "0.047",
"red" : "0.780"
"blue" : "251",
"green" : "245",
"red" : "238"
}
},
"idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF5",
"green" : "0xFA",
"red" : "0xE4"
"blue" : "0x5A",
"green" : "0x37",
"red" : "0x29"
}
},
"idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF6",
"green" : "0xF6",
"red" : "0xEF"
"blue" : "97",
"green" : "172",
"red" : "42"
}
},
"idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.694",
"green" : "0.694",
"red" : "0.961"
"blue" : "0x5A",
"green" : "0x37",
"red" : "0x29"
}
},
"idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.890",
"green" : "0.906",
"red" : "0.976"
"blue" : "46",
"green" : "42",
"red" : "167"
}
},
"idiom" : "universal"

View File

@ -76,7 +76,6 @@ struct ValidationFailedView: View {
.navigationBarHidden(true)
.applyErredScreenBackground()
}
.preferredColorScheme(.light)
}
}

View File

@ -77,7 +77,6 @@ struct ValidationSucceededView: View {
}
.navigationBarHidden(true)
.applySucceededScreenBackground()
.preferredColorScheme(.light)
}
}

View File

@ -40,7 +40,7 @@
"validationFailed.title" = "Ouch, sorry, no.";
"validationFailed.description" = "Your placed words did not match your secret recovery phrase.";
"validationFailed.incorrectBackupDescription" = "Remember, you can't recover your funds if you lose (or incorrectly save) these 24 words.";
"validationFailed.button.tryAgain" = "I'm ready to try again";
"validationFailed.button.tryAgain" = "Try again";
// MARK: - Recovery Phrase Test Preamble
"recoveryPhraseTestPreamble.title" = "First things first";

View File

@ -10,13 +10,16 @@ import SwiftUI
/// A Vertical LinearGradient that takes an array of Colors and renders them vertically
/// in a centered fashion mostly used as a background for Screen views..
struct ScreenBackground: View {
@Environment(\.colorScheme) var colorScheme
var colors: [Color]
var darkGradientEndPointY = 1.0
var body: some View {
LinearGradient(
colors: colors,
startPoint: UnitPoint(x: 0.5, y: 0),
endPoint: UnitPoint(x: 0.5, y: 1)
endPoint: UnitPoint(x: 0.5, y: colorScheme == .dark ? darkGradientEndPointY : 1)
)
}
}
@ -31,11 +34,15 @@ extension ScreenBackground {
}
struct ScreenBackgroundModifier: ViewModifier {
var colors: [Color]
var darkGradientEndPointY = 1.0
func body(content: Content) -> some View {
ZStack {
ScreenBackground(colors: colors)
.edgesIgnoringSafeArea(.all)
ScreenBackground(
colors: colors,
darkGradientEndPointY: darkGradientEndPointY
)
.edgesIgnoringSafeArea(.all)
content
}
@ -62,7 +69,8 @@ extension View {
colors: [
Asset.Colors.ScreenBackground.redGradientStart.color,
Asset.Colors.ScreenBackground.redGradientEnd.color
]
],
darkGradientEndPointY: 0.4
)
)
}
@ -73,7 +81,8 @@ extension View {
colors: [
Asset.Colors.ScreenBackground.greenGradientStart.color,
Asset.Colors.ScreenBackground.greenGradientEnd.color
]
],
darkGradientEndPointY: 0.6
)
)
}

View File

@ -40,12 +40,36 @@ enum Badge: Equatable {
struct ErrorBadge: View {
var body: some View {
Text("X")
.font(.custom(FontFamily.Rubik.bold.name, size: 36))
.foregroundColor(Asset.Colors.BackgroundColors.red.color)
.frame(width: 60, height: 60, alignment: .center)
.background(Asset.Colors.Onboarding.badgeBackground.color)
.cornerRadius(10)
ZStack {
Rectangle()
.fill(
LinearGradient(
colors: [
Asset.Colors.Onboarding.circularFrameGradientStart.color,
Asset.Colors.Onboarding.circularFrameGradientEnd.color
],
startPoint: .top,
endPoint: .bottom
)
)
.frame(width: 60, height: 60, alignment: .center)
.cornerRadius(10)
Rectangle()
.fill(Asset.Colors.Onboarding.badgeBackground.color)
.frame(width: 55, height: 55, alignment: .center)
.cornerRadius(10)
.shadow(
color: Asset.Colors.Onboarding.badgeShadow.color,
radius: 10,
x: 0,
y: 0
)
Text("X")
.font(.custom(FontFamily.Rubik.bold.name, size: 36))
.foregroundColor(Asset.Colors.BackgroundColors.red.color)
}
}
}