mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
🔀 Merge branch 'trunk'
# Conflicts: # modules/ppcp-settings/resources/js/Components/ReusableComponents/SelectBox.js
This commit is contained in:
commit
09ca3d0871
24 changed files with 345 additions and 176 deletions
|
@ -46,8 +46,31 @@ const SelectableContent = ( {
|
|||
);
|
||||
};
|
||||
|
||||
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 (
|
||||
<div className={ boxClassName }>
|
||||
<div
|
||||
className={ boxClassName }
|
||||
onClick={ type === 'checkbox' ? handleClick : undefined }
|
||||
>
|
||||
<InputField isRadio={ type === 'radio' } />
|
||||
|
||||
<div className="ppcp-r-select-box__content">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue