💄 Give payment method icons a fixed size

This commit is contained in:
Philipp Stracker 2025-01-27 10:55:17 +01:00
parent 5c5601af97
commit 6e2f58c565
No known key found for this signature in database
3 changed files with 19 additions and 8 deletions

View file

@ -1,15 +1,20 @@
import { Icon } from '@wordpress/components';
import data from '../../utils/data';
const PaymentMethodIcon = ( props ) => {
if (
( Array.isArray( props.icons ) &&
props.icons.includes( props.type ) ) ||
props.icons === 'all'
) {
return data().getImage( 'icon-button-' + props.type + '.svg' );
const PaymentMethodIcon = ( { icons, type } ) => {
const validIcon = Array.isArray( icons ) && icons.includes( type );
if ( validIcon || icons === 'all' ) {
return (
<Icon
icon={ data().getImage( 'icon-button-' + type + '.svg' ) }
className="ppcp--method-icon"
/>
);
}
return <></>;
return null;
};
export default PaymentMethodIcon;