Render from content instead of edit prop and adjust css
This commit is contained in:
parent
e3545086d0
commit
3e98e05403
|
@ -142,20 +142,6 @@ const ExpressPaymentMethods = () => {
|
|||
[ __internalSetExpressPaymentError, onExpressPaymentError ]
|
||||
);
|
||||
|
||||
// In the editor, we apply styles to the button containers to show the changes of the height and border-radius controls,
|
||||
// which would be passed to the payment APIs on the front-end
|
||||
const stylesForButtonContainers = isEditor
|
||||
? {
|
||||
height: `${ showButtonStyles ? buttonHeight : '48' }px`,
|
||||
borderRadius: `${
|
||||
showButtonStyles ? buttonBorderRadius : '4'
|
||||
}px`,
|
||||
pointerEvents: 'none',
|
||||
userSelect: 'none',
|
||||
ariaDisabled: true,
|
||||
}
|
||||
: {};
|
||||
|
||||
/**
|
||||
* @todo Find a way to Memoize Express Payment Method Content
|
||||
*
|
||||
|
@ -167,15 +153,9 @@ const ExpressPaymentMethods = () => {
|
|||
const content =
|
||||
entries.length > 0 ? (
|
||||
entries.map( ( [ id, paymentMethod ] ) => {
|
||||
const expressPaymentMethod = isEditor
|
||||
? paymentMethod.edit
|
||||
: paymentMethod.content;
|
||||
const expressPaymentMethod = paymentMethod.content;
|
||||
return isValidElement( expressPaymentMethod ) ? (
|
||||
<li
|
||||
key={ id }
|
||||
id={ `express-payment-method-${ id }` }
|
||||
style={ stylesForButtonContainers }
|
||||
>
|
||||
<li key={ id } id={ `express-payment-method-${ id }` }>
|
||||
{ cloneElement( expressPaymentMethod, {
|
||||
...paymentMethodInterface,
|
||||
onClick: onExpressPaymentClick( id ),
|
||||
|
|
|
@ -33,19 +33,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Center images rendered in place of buttons in the editor
|
||||
.wc-block-components-express-payment {
|
||||
.wc-block-components-express-payment__event-buttons {
|
||||
> li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
> img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
.wc-block-components-express-payment__event-buttons li {
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
|
|
@ -42,22 +42,13 @@
|
|||
position: absolute;
|
||||
top: 29px;
|
||||
right: 12px;
|
||||
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
||||
color: var(
|
||||
--wp-components-color-accent,
|
||||
var(--wp-admin-theme-color, #3858e9)
|
||||
);
|
||||
}
|
||||
|
||||
// Center images rendered in place of buttons in the editor
|
||||
.wc-block-components-express-payment {
|
||||
.wc-block-components-express-payment__event-buttons {
|
||||
> li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
> img {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
.wc-block-components-express-payment__event-buttons > li {
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue