import { Button } from '@wordpress/components'; import PaymentMethodIcon from './PaymentMethodIcon'; import { PayPalCheckbox } from './Fields'; import { useState } from '@wordpress/element'; import { ToggleControl } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import data from '../../utils/data'; const PaymentMethodItem = ( props ) => { const [ paymentMethodState, setPaymentMethodState ] = useState(); const [ modalIsVisible, setModalIsVisible ] = useState( false ); let Modal = null; if ( props?.modal ) { Modal = props.modal; } const handleCheckboxState = ( checked ) => { if ( checked ) { setPaymentMethodState( props.payment_method_id ); } else { setPaymentMethodState( null ); } }; return ( <>
{ props.title }

{ props.description }

handleCheckboxState( newValue ) } />
setModalIsVisible( true ) } > { Modal && data().getImage( 'icon-settings.svg' ) }
{ Modal && modalIsVisible && ( ) } ); }; export default PaymentMethodItem;