Skip to content

Commit

Permalink
Fix broken Express Checkout buttons when size is set to "Large" (#9327)
Browse files Browse the repository at this point in the history
  • Loading branch information
asumaran authored Aug 24, 2024
1 parent f9fc6a1 commit 0bb0680
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog/as-fix-max-height-allowed
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Ensure 55px is the maximum height for Apple Pay button.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ const adjustButtonHeights = ( buttonOptions, expressPaymentMethod ) => {
// Apple Pay has a nearly imperceptible height difference. We increase it by 1px here.
if ( buttonOptions.buttonTheme.applePay === 'black' ) {
if ( expressPaymentMethod === 'applePay' ) {
buttonOptions.buttonHeight = buttonOptions.buttonHeight + 0.4;
// The maximum allowed size is 55px.
buttonOptions.buttonHeight = Math.min(
buttonOptions.buttonHeight + 0.4,
55
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ const ExpressCheckoutContainer = ( props ) => {
};

return (
<Elements stripe={ stripePromise } options={ options }>
<ExpressCheckoutComponent { ...props } />
</Elements>
<div style={ { minHeight: '40px' } }>
<Elements stripe={ stripePromise } options={ options }>
<ExpressCheckoutComponent { ...props } />
</Elements>
</div>
);
};

Expand Down

0 comments on commit 0bb0680

Please sign in to comment.