Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add success color background API #1733

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private fun buildPrimaryButtonColors(colorParams: Bundle, default: PaymentSheet.
},
onBackground = colorFromHexOrDefault(colorParams.getString(PaymentSheetAppearanceKeys.TEXT), default.onBackground),
border = colorFromHexOrDefault(colorParams.getString(PaymentSheetAppearanceKeys.BORDER), default.border),
successBackgroundColor = colorFromHexOrDefault(colorParams.getString(PaymentSheetAppearanceKeys.SUCCESS_BACKGROUND, default.successBackgroundColor),
)
}

Expand Down Expand Up @@ -203,5 +204,6 @@ private class PaymentSheetAppearanceKeys {
const val PRIMARY_BUTTON = "primaryButton"
const val TEXT = "text"
const val BORDER = "border"
const val SUCCESS_BACKGROUND = "successBackground"
}
}
2 changes: 2 additions & 0 deletions ios/PaymentSheetAppearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
primaryButton.backgroundColor = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BACKGROUND, lightParams: lightModeParams, darkParams: darkModeParams)
primaryButton.textColor = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.TEXT, lightParams: lightModeParams, darkParams: darkModeParams)
primaryButton.borderColor = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BORDER, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.primaryButton.borderColor
primaryButton.successBackgroundColor = try buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BACKGROUND_SUCCESS, lightParams: lightModeParams, darkParams: darkModeParams)

Check failure on line 125 in ios/PaymentSheetAppearance.swift

View workflow job for this annotation

GitHub Actions / e2e-ios-test

value of optional type 'UIColor?' must be unwrapped to a value of type 'UIColor'
}

return primaryButton
Expand Down Expand Up @@ -207,4 +208,5 @@
static let PRIMARY_BUTTON = "primaryButton"
static let TEXT = "text"
static let BORDER = "border"
static let BACKGROUND_SUCCESS = "green"
}
4 changes: 4 additions & 0 deletions src/types/PaymentSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ export type PrimaryButtonColorConfig = {
* @default The root `appearance.colors.primary`
*/
background: string;
/** The background color used for the primary button when in the success state in PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.
* @default green
*/
successBackground: string;
/** The color of the text for the primary button in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.
* @default White or black, depending on the color of the button.
*/
Expand Down
Loading