mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
♻️ Switch ControlRadio to use default WP component
This commit is contained in:
parent
3894919d43
commit
4015a8fa3c
3 changed files with 20 additions and 11 deletions
|
@ -1,18 +1,13 @@
|
|||
import { PayPalRdbWithContent } from '../Fields';
|
||||
import { Action } from '../Elements';
|
||||
import { RadioGroup } from '../Fields';
|
||||
|
||||
const ControlRadioGroup = ( { options, value, onChange } ) => (
|
||||
<Action>
|
||||
{ options.map( ( { value: optionValue, label, description } ) => (
|
||||
<PayPalRdbWithContent
|
||||
key={ optionValue }
|
||||
value={ optionValue }
|
||||
currentValue={ value }
|
||||
handleRdbState={ onChange }
|
||||
label={ label }
|
||||
description={ description }
|
||||
/>
|
||||
) ) }
|
||||
<RadioGroup
|
||||
options={ options }
|
||||
selected={ value }
|
||||
onChange={ onChange }
|
||||
/>
|
||||
</Action>
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import { RadioControl } from '@wordpress/components';
|
||||
|
||||
const RadioGroup = ( { options, selected, onChange } ) => {
|
||||
return (
|
||||
<RadioControl
|
||||
options={ options }
|
||||
onChange={ onChange }
|
||||
selected={ selected }
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default RadioGroup;
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
export { default as PayPalCheckbox } from './Checkbox';
|
||||
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';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue