woocommerce-paypal-payments/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/PaymentMethodItemBlock.js
Emili Castells Guasch 7b30568dd2 Merge trunk
2025-01-28 11:29:15 +01:00

49 lines
1.3 KiB
JavaScript

import { ToggleControl } from '@wordpress/components';
import SettingsBlock from '../SettingsBlock';
import PaymentMethodIcon from '../PaymentMethodIcon';
const PaymentMethodItemBlock = ( {
paymentMethod,
onTriggerModal,
onSelect,
isSelected,
} ) => {
return (
<SettingsBlock className="ppcp--method-item" separatorAndGap={ false }>
<div className="ppcp--method-inner">
<div className="ppcp--method-title-wrapper">
{ paymentMethod?.icon && (
<PaymentMethodIcon
icons={ [ paymentMethod.icon ] }
type={ paymentMethod.icon }
/>
) }
<span className="ppcp--method-title">
{ paymentMethod.itemTitle }
</span>
</div>
<p className="ppcp--method-description">
{ paymentMethod.itemDescription }
</p>
<div className="ppcp--method-footer">
<ToggleControl
__nextHasNoMarginBottom={ true }
checked={ isSelected }
onChange={ onSelect }
/>
{ paymentMethod?.fields && onTriggerModal && (
<Button
className="ppcp--method-settings"
onClick={ onTriggerModal }
>
<Icon icon={ cog } />
</Button>
) }
</div>
</div>
</SettingsBlock>
);
};
export default PaymentMethodItemBlock;