♻️ Switch ControlRadio to use default WP component

This commit is contained in:
Philipp Stracker 2025-01-23 16:04:06 +01:00
parent 3894919d43
commit 4015a8fa3c
No known key found for this signature in database
3 changed files with 20 additions and 11 deletions

View file

@ -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>
);

View file

@ -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;

View file

@ -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';