import data from '../../utils/data'; import { PayPalCheckbox, PayPalRdb } from './Fields'; const SelectBox = ( props ) => { let boxClassName = 'ppcp-r-select-box'; if ( props.value === props.currentValue || ( Array.isArray( props.currentValue ) && props.currentValue.includes( props.value ) ) ) { boxClassName += ' selected'; } const handleClick = () => { if ( props.type === 'checkbox' ) { let newValue; if ( Array.isArray( props.currentValue ) ) { if ( props.currentValue.includes( props.value ) ) { newValue = props.currentValue.filter( ( optionValue ) => optionValue !== props.value ); } else { newValue = [ ...props.currentValue, props.value ]; } } else { newValue = ! props.currentValue; } props.changeCallback( newValue ); } }; return (
{ props.description }
{ props.children && (