mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
💄 Fix button size in stand-alone gateway
This commit is contained in:
parent
f1c5b70877
commit
cffaa7a92f
1 changed files with 11 additions and 7 deletions
|
@ -437,28 +437,32 @@ class ApplePayButton {
|
|||
addButton() {
|
||||
this.log( 'addButton' );
|
||||
|
||||
const appleContainer = document.getElementById( this.wrapperId );
|
||||
const wrapper = this.wrapperElement;
|
||||
const style = this.buttonStyle;
|
||||
const id = 'apple-' + this.wrapperId;
|
||||
|
||||
if ( ! appleContainer ) {
|
||||
if ( ! wrapper ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ppcpStyle = this.ppcpStyle;
|
||||
|
||||
appleContainer.innerHTML = `<apple-pay-button id='${ id }' buttonstyle='${ style.color }' type='${ style.type }' locale='${ style.lang }' />`;
|
||||
appleContainer.classList.add( 'ppcp-button-' + ppcpStyle.shape );
|
||||
wrapper.innerHTML = `<apple-pay-button id='${ id }' buttonstyle='${ style.color }' type='${ style.type }' locale='${ style.lang }' />`;
|
||||
wrapper.classList.add(
|
||||
`ppcp-button-${ ppcpStyle.shape }`,
|
||||
'ppcp-button-apm',
|
||||
'ppcp-button-applepay'
|
||||
);
|
||||
|
||||
if ( ppcpStyle.height ) {
|
||||
appleContainer.style.setProperty(
|
||||
wrapper.style.setProperty(
|
||||
'--apple-pay-button-height',
|
||||
`${ ppcpStyle.height }px`
|
||||
);
|
||||
appleContainer.style.height = `${ ppcpStyle.height }px`;
|
||||
wrapper.style.height = `${ ppcpStyle.height }px`;
|
||||
}
|
||||
|
||||
return appleContainer.querySelector( 'apple-pay-button' );
|
||||
return wrapper.querySelector( 'apple-pay-button' );
|
||||
}
|
||||
|
||||
//------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue