Merge pull request #206 from LukasKorba/205_validation_result_dark

Validation Failure/Success updated to handle dark mode
This commit is contained in:
Francisco Gindre 2022-03-15 13:28:30 -03:00 committed by GitHub
commit 5625ce0908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 29 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@
"validationFailed.title" = "Ouch, sorry, no."; "validationFailed.title" = "Ouch, sorry, no.";
"validationFailed.description" = "Your placed words did not match your secret recovery phrase."; "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.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 // MARK: - Recovery Phrase Test Preamble
"recoveryPhraseTestPreamble.title" = "First things first"; "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 /// 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.. /// in a centered fashion mostly used as a background for Screen views..
struct ScreenBackground: View { struct ScreenBackground: View {
@Environment(\.colorScheme) var colorScheme
var colors: [Color] var colors: [Color]
var darkGradientEndPointY = 1.0
var body: some View { var body: some View {
LinearGradient( LinearGradient(
colors: colors, colors: colors,
startPoint: UnitPoint(x: 0.5, y: 0), 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,10 +34,14 @@ extension ScreenBackground {
} }
struct ScreenBackgroundModifier: ViewModifier { struct ScreenBackgroundModifier: ViewModifier {
var colors: [Color] var colors: [Color]
var darkGradientEndPointY = 1.0
func body(content: Content) -> some View { func body(content: Content) -> some View {
ZStack { ZStack {
ScreenBackground(colors: colors) ScreenBackground(
colors: colors,
darkGradientEndPointY: darkGradientEndPointY
)
.edgesIgnoringSafeArea(.all) .edgesIgnoringSafeArea(.all)
content content
@ -62,7 +69,8 @@ extension View {
colors: [ colors: [
Asset.Colors.ScreenBackground.redGradientStart.color, Asset.Colors.ScreenBackground.redGradientStart.color,
Asset.Colors.ScreenBackground.redGradientEnd.color Asset.Colors.ScreenBackground.redGradientEnd.color
] ],
darkGradientEndPointY: 0.4
) )
) )
} }
@ -73,7 +81,8 @@ extension View {
colors: [ colors: [
Asset.Colors.ScreenBackground.greenGradientStart.color, Asset.Colors.ScreenBackground.greenGradientStart.color,
Asset.Colors.ScreenBackground.greenGradientEnd.color Asset.Colors.ScreenBackground.greenGradientEnd.color
] ],
darkGradientEndPointY: 0.6
) )
) )
} }

View File

@ -40,12 +40,36 @@ enum Badge: Equatable {
struct ErrorBadge: View { struct ErrorBadge: View {
var body: some View { var body: some View {
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") Text("X")
.font(.custom(FontFamily.Rubik.bold.name, size: 36)) .font(.custom(FontFamily.Rubik.bold.name, size: 36))
.foregroundColor(Asset.Colors.BackgroundColors.red.color) .foregroundColor(Asset.Colors.BackgroundColors.red.color)
.frame(width: 60, height: 60, alignment: .center) }
.background(Asset.Colors.Onboarding.badgeBackground.color)
.cornerRadius(10)
} }
} }