From 78e1290d2a9f903f929806221331d8b4e898f4fe Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:28:15 +0000 Subject: [PATCH] Update to the new SendButton design. (#130) --- Sources/Compound/Buttons/SendButton.swift | 21 +++++++++++--------- Sources/Compound/Colors/CompoundColors.swift | 1 - Tests/CompoundTests/__Snapshots__ | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Sources/Compound/Buttons/SendButton.swift b/Sources/Compound/Buttons/SendButton.swift index b96e7ac..a9b4713 100644 --- a/Sources/Compound/Buttons/SendButton.swift +++ b/Sources/Compound/Buttons/SendButton.swift @@ -15,9 +15,18 @@ public struct SendButton: View { /// The action to perform when the user triggers the button. public let action: () -> Void - private var iconColor: Color { isEnabled ? .compound.iconOnSolidPrimary : .compound.iconQuaternary } - private var gradient: Gradient { isEnabled ? Color.compound.gradientSendButton : .init(colors: [.clear]) } - private var colorSchemeOverride: ColorScheme { isEnabled ? .light : colorScheme } + private var iconColor: Color { isEnabled ? .compound.iconPrimary : .compound.iconQuaternary } + private var gradient: Gradient { isEnabled ? enabledGradient : .init(colors: [.clear]) } + private var colorSchemeOverride: ColorScheme { isEnabled ? .dark : colorScheme } + + /// This is a custom gradient used for this button, the colours don't come from our core tokens + /// and aren't reactive to light/dark mode or high contrast, so it is hard coded in here. + private var enabledGradient: Gradient { + .init(stops: [Gradient.Stop(color: Color(red: 0.47, green: 0.87, blue: 0.6), location: 0.00), + Gradient.Stop(color: Color(red: 0.05, green: 0.74, blue: 0.55), location: 0.30), + Gradient.Stop(color: Color(red: 0.07, green: 0.52, blue: 0.52), location: 0.60), + Gradient.Stop(color: Color(red: 0.14, green: 0.27, blue: 0.42), location: 1.00)]) + } /// Creates a send button that performs the provided action. public init(action: @escaping () -> Void) { @@ -38,12 +47,6 @@ public struct SendButton: View { var buttonShape: some View { Circle() .fill(LinearGradient(gradient: gradient, startPoint: .top, endPoint: .bottom)) - .overlay { - Circle() - .fill(EllipticalGradient(gradient: gradient)) - .opacity(0.4) - .blendMode(.overlay) - } } } diff --git a/Sources/Compound/Colors/CompoundColors.swift b/Sources/Compound/Colors/CompoundColors.swift index 1221ad8..3e9e7d1 100644 --- a/Sources/Compound/Colors/CompoundColors.swift +++ b/Sources/Compound/Colors/CompoundColors.swift @@ -125,7 +125,6 @@ public class CompoundColors { // MARK: - Gradients public let gradientSuperButton = Gradient(colors: [coreTokens.blue900, coreTokens.green1100]) - public let gradientSendButton = Gradient(colors: [coreTokens.green700, coreTokens.blue900]) } private extension UITraitCollection { diff --git a/Tests/CompoundTests/__Snapshots__ b/Tests/CompoundTests/__Snapshots__ index e24f7bf..24eee0c 160000 --- a/Tests/CompoundTests/__Snapshots__ +++ b/Tests/CompoundTests/__Snapshots__ @@ -1 +1 @@ -Subproject commit e24f7bf50a533e451034f435c9d40939e2522b32 +Subproject commit 24eee0c6a9348ad04f298d44d73d1d2a33ae6eba