mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
🔥 Remove unused files
This commit is contained in:
parent
a64b1b9d24
commit
3840352c54
3 changed files with 0 additions and 99 deletions
|
@ -1,93 +0,0 @@
|
|||
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 (
|
||||
<PayPalRdb
|
||||
name={ name }
|
||||
value={ value }
|
||||
handleRdbState={ changeCallback }
|
||||
currentValue={ currentValue }
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<PayPalCheckbox
|
||||
value={ value }
|
||||
changeCallback={ changeCallback }
|
||||
currentValue={ currentValue }
|
||||
checked={ checked }
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
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 }
|
||||
onClick={ type === 'checkbox' ? handleClick : undefined }
|
||||
>
|
||||
<InputField isRadio={ type === 'radio' } />
|
||||
|
||||
<div className="ppcp-r-select-box__content">
|
||||
<div className="ppcp-r-select-box__content-inner">
|
||||
<span className="ppcp-r-select-box__title">{ title }</span>
|
||||
<p className="ppcp-r-select-box__description">
|
||||
{ description }
|
||||
</p>
|
||||
{ children && (
|
||||
<div className="ppcp-r-select-box__additional-content">
|
||||
{ children }
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SelectableContent;
|
|
@ -7,6 +7,5 @@ export { default as CheckboxGroup } from './CheckboxGroup';
|
|||
export { default as RadioGroup } from './RadioGroup';
|
||||
export { default as PayPalRdb } from './RadioButton';
|
||||
export { default as PayPalRdbWithContent } from './RadioContent';
|
||||
export { default as SelectBox } from './SelectableContent';
|
||||
export { default as OptionSelector } from './OptionSelector';
|
||||
export { default as Select } from './Select';
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
const SelectBoxWrapper = ( props ) => {
|
||||
return <div className="ppcp-r-select-box-wrapper">{ props.children }</div>;
|
||||
};
|
||||
|
||||
export default SelectBoxWrapper;
|
Loading…
Add table
Add a link
Reference in a new issue