From a9c31f9a62580cd4e9bbabeafde8317e1dbb8309 Mon Sep 17 00:00:00 2001 From: Krisjanis Gaidis Date: Tue, 15 Nov 2022 17:42:47 -0500 Subject: [PATCH] Financial Connections: changed button states to match new designs. --- .../AccountPickerFooterView.swift | 1 - .../ManualEntryViewController.swift | 1 - .../Native/Shared/Button+Extensions.swift | 23 +++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/StripeFinancialConnections/StripeFinancialConnections/Source/Native/AccountPicker/AccountPickerFooterView.swift b/StripeFinancialConnections/StripeFinancialConnections/Source/Native/AccountPicker/AccountPickerFooterView.swift index 8726a13e3dd..efe5e91819b 100644 --- a/StripeFinancialConnections/StripeFinancialConnections/Source/Native/AccountPicker/AccountPickerFooterView.swift +++ b/StripeFinancialConnections/StripeFinancialConnections/Source/Native/AccountPicker/AccountPickerFooterView.swift @@ -64,7 +64,6 @@ final class AccountPickerFooterView: UIView { func didSelectAccounts(count numberOfAccountsSelected: Int) { linkAccountsButton.isEnabled = (numberOfAccountsSelected > 0) - linkAccountsButton.alpha = linkAccountsButton.isEnabled ? 1.0 : 0.5 } } diff --git a/StripeFinancialConnections/StripeFinancialConnections/Source/Native/ManualEntry/ManualEntryViewController.swift b/StripeFinancialConnections/StripeFinancialConnections/Source/Native/ManualEntry/ManualEntryViewController.swift index 656a7643ed1..e216c978497 100644 --- a/StripeFinancialConnections/StripeFinancialConnections/Source/Native/ManualEntry/ManualEntryViewController.swift +++ b/StripeFinancialConnections/StripeFinancialConnections/Source/Native/ManualEntry/ManualEntryViewController.swift @@ -110,7 +110,6 @@ final class ManualEntryViewController: UIViewController { private func adjustContinueButtonStateIfNeeded() { footerView.continueButton.isEnabled = (manualEntryFormView.routingAndAccountNumber != nil) - footerView.continueButton.alpha = footerView.continueButton.isEnabled ? 1.0 : 0.5 } } diff --git a/StripeFinancialConnections/StripeFinancialConnections/Source/Native/Shared/Button+Extensions.swift b/StripeFinancialConnections/StripeFinancialConnections/Source/Native/Shared/Button+Extensions.swift index c7749116c15..804a831e1e5 100644 --- a/StripeFinancialConnections/StripeFinancialConnections/Source/Native/Shared/Button+Extensions.swift +++ b/StripeFinancialConnections/StripeFinancialConnections/Source/Native/Shared/Button+Extensions.swift @@ -12,21 +12,30 @@ extension Button.Configuration { static var financialConnectionsPrimary: Button.Configuration { var primaryButtonConfiguration = Button.Configuration.primary() primaryButtonConfiguration.font = .stripeFont(forTextStyle: .bodyEmphasized) + // default primaryButtonConfiguration.backgroundColor = .textBrand primaryButtonConfiguration.foregroundColor = .white - // disabed state is shown by making the whole button 0.5 opacity - // we can't make `backgroundColor` and foregroundColor` be 0.5 opacity - // because it causes color blending issues - primaryButtonConfiguration.disabledBackgroundColor = primaryButtonConfiguration.backgroundColor - primaryButtonConfiguration.disabledForegroundColor = primaryButtonConfiguration.foregroundColor + // disabled + primaryButtonConfiguration.disabledBackgroundColor = .textBrand + primaryButtonConfiguration.disabledForegroundColor = .white.withAlphaComponent(0.3) + // pressed + primaryButtonConfiguration.colorTransforms.highlightedBackground = .darken(amount: 0.23) // this tries to simulate `brand600` + primaryButtonConfiguration.colorTransforms.highlightedForeground = nil return primaryButtonConfiguration } static var financialConnectionsSecondary: Button.Configuration { var secondaryButtonConfiguration = Button.Configuration.secondary() secondaryButtonConfiguration.font = .stripeFont(forTextStyle: .bodyEmphasized) - secondaryButtonConfiguration.foregroundColor = .textSecondary - secondaryButtonConfiguration.backgroundColor = .borderNeutral + // default + secondaryButtonConfiguration.foregroundColor = .textPrimary + secondaryButtonConfiguration.backgroundColor = .backgroundContainer + // disabled + secondaryButtonConfiguration.disabledForegroundColor = .textPrimary.withAlphaComponent(0.3) + secondaryButtonConfiguration.disabledBackgroundColor = .backgroundContainer + // pressed + secondaryButtonConfiguration.colorTransforms.highlightedBackground = .darken(amount: 0.04) // this tries to simulate `neutral100` + secondaryButtonConfiguration.colorTransforms.highlightedForeground = nil return secondaryButtonConfiguration } }