Skip to content

Commit

Permalink
Fix WooPay button preview in plugin settings. (#9649)
Browse files Browse the repository at this point in the history
Co-authored-by: Ricardo Metring <[email protected]>
  • Loading branch information
rafaelzaleski and ricardo authored Oct 31, 2024
1 parent ccff836 commit e672cc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-9537-woopay-button-size-preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix WooPay button preview in plugin settings.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ export const WoopayExpressCheckoutButton = ( {
// If we are on the checkout block, we receive button attributes which overwrite the extension specific settings
if ( typeof buttonAttributes !== 'undefined' ) {
buttonHeight = buttonAttributes.height || buttonHeight;
borderRadius = buttonAttributes.borderRadius || borderRadius;
borderRadius = buttonAttributes.borderRadius ?? borderRadius;
}

const buttonSize = buttonSizeMap.get( buttonHeight );
const buttonSize =
buttonSizeMap.get( buttonHeight?.toString() ) || 'medium';

const buttonText =
ButtonTypeTextMap[ buttonType || 'default' ] ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ const WooPayButtonPreview = ( { size, buttonType, theme, radius } ) => (
buttonSizeToPxMap[ size ] || buttonSizeToPxMap.medium
}px`,
size,
radius,
} }
buttonAttributes={ {
height: buttonSizeToPxMap[ size ] || buttonSizeToPxMap.medium,
borderRadius: radius,
} }
/>
);
Expand Down

0 comments on commit e672cc7

Please sign in to comment.