Skip to content

Commit

Permalink
Merge pull request #1578 from stripe-ios/kg-newbuttons
Browse files Browse the repository at this point in the history
Financial Connections: changed button states to match new designs
  • Loading branch information
kgaidis-stripe authored Nov 16, 2022
2 parents a645745 + a9c31f9 commit d8e8513
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit d8e8513

Please sign in to comment.