mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
Apple Pay: Fix default height and border radius
This commit is contained in:
parent
9766ade13d
commit
b63b1e7c39
2 changed files with 26 additions and 18 deletions
|
@ -414,24 +414,32 @@ class ApplePayButton extends PaymentButton {
|
|||
? this.buttonAttributes
|
||||
: this.#storedButtonAttributes;
|
||||
|
||||
// Apply height if available
|
||||
if ( attributes?.height ) {
|
||||
const height = parseInt( attributes.height, 10 );
|
||||
if ( ! isNaN( height ) ) {
|
||||
wrapper.style.setProperty(
|
||||
'--apple-pay-button-height',
|
||||
`${ height }px`
|
||||
);
|
||||
wrapper.style.height = `${ height }px`;
|
||||
}
|
||||
const defaultHeight = 48;
|
||||
const defaultBorderRadius = 4;
|
||||
|
||||
const height = attributes?.height
|
||||
? parseInt( attributes.height, 10 )
|
||||
: defaultHeight;
|
||||
|
||||
if ( ! isNaN( height ) ) {
|
||||
wrapper.style.setProperty(
|
||||
'--apple-pay-button-height',
|
||||
`${ height }px`
|
||||
);
|
||||
wrapper.style.height = `${ height }px`;
|
||||
} else {
|
||||
wrapper.style.setProperty(
|
||||
'--apple-pay-button-height',
|
||||
`${ defaultHeight }px`
|
||||
);
|
||||
wrapper.style.height = `${ defaultHeight }px`;
|
||||
}
|
||||
|
||||
// Apply border radius if available
|
||||
if ( attributes?.borderRadius ) {
|
||||
const borderRadius = parseInt( attributes.borderRadius, 10 );
|
||||
if ( ! isNaN( borderRadius ) ) {
|
||||
wrapper.style.borderRadius = `${ borderRadius }px`;
|
||||
}
|
||||
const borderRadius = attributes?.borderRadius
|
||||
? parseInt( attributes.borderRadius, 10 )
|
||||
: defaultBorderRadius;
|
||||
if ( ! isNaN( borderRadius ) ) {
|
||||
wrapper.style.borderRadius = `${ borderRadius }px`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue