mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
26 lines
773 B
JavaScript
26 lines
773 B
JavaScript
import { useMemo } from '@wordpress/element';
|
|
import { combineStyles } from '../../../../../ppcp-button/resources/js/modules/Helper/PaymentButtonHelpers';
|
|
|
|
const useButtonStyles = ( buttonConfig, ppcpConfig, buttonAttributes ) => {
|
|
return useMemo( () => {
|
|
const styles = combineStyles(
|
|
ppcpConfig?.button || {},
|
|
buttonConfig?.button || {}
|
|
);
|
|
|
|
if ( buttonAttributes && styles.Default ) {
|
|
styles.Default.height =
|
|
buttonAttributes.height || styles.Default.height;
|
|
styles.Default.borderRadius =
|
|
buttonAttributes.borderRadius || styles.Default.borderRadius;
|
|
}
|
|
|
|
if ( styles.MiniCart?.type === 'buy' ) {
|
|
styles.MiniCart.type = 'pay';
|
|
}
|
|
|
|
return styles;
|
|
}, [ buttonConfig, ppcpConfig, buttonAttributes ] );
|
|
};
|
|
|
|
export default useButtonStyles;
|