Skip to content

Commit

Permalink
Update to the new SendButton design. (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave authored Dec 5, 2024
1 parent 901f3f2 commit 78e1290
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
21 changes: 12 additions & 9 deletions Sources/Compound/Buttons/SendButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
}
}

Expand Down
1 change: 0 additions & 1 deletion Sources/Compound/Colors/CompoundColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 78e1290

Please sign in to comment.