import classNames from 'classnames'; import { PayPalCheckbox, PayPalRdb } from './index'; const SelectableContent = ( { title, description, type = 'checkbox', children, name, value, changeCallback, currentValue, checked = null, } ) => { let isSelected; if ( Array.isArray( currentValue ) ) { isSelected = currentValue.includes( value ); } else { isSelected = value === currentValue; } const boxClassName = classNames( 'ppcp-r-select-box', { 'ppcp--selected': isSelected, } ); const InputField = ( { isRadio } ) => { if ( isRadio ) { return ( ); } return ( ); }; const handleClick = () => { if ( type === 'checkbox' ) { let newValue; if ( Array.isArray( currentValue ) ) { if ( currentValue.includes( value ) ) { newValue = currentValue.filter( ( optionValue ) => optionValue !== value ); } else { newValue = [ ...currentValue, value ]; } } else { newValue = ! currentValue; } changeCallback( newValue ); } }; return (
{ title }

{ description }

{ children && (
{ children }
) }
); }; export default SelectableContent;