mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🚚 Move settings-controls into new subfolder
This commit is contained in:
parent
b9df4d06a4
commit
7f861c5825
19 changed files with 23 additions and 20 deletions
|
@ -0,0 +1,18 @@
|
|||
import { Button } from '@wordpress/components';
|
||||
|
||||
import { Action } from '../Elements';
|
||||
|
||||
const ControlButton = ( {
|
||||
type = 'secondary',
|
||||
isBusy,
|
||||
onClick,
|
||||
buttonLabel,
|
||||
} ) => (
|
||||
<Action>
|
||||
<Button isBusy={ isBusy } variant={ type } onClick={ onClick }>
|
||||
{ buttonLabel }
|
||||
</Button>
|
||||
</Action>
|
||||
);
|
||||
|
||||
export default ControlButton;
|
|
@ -0,0 +1,19 @@
|
|||
import { PayPalRdbWithContent } from '../Fields';
|
||||
import { Action } from '../Elements';
|
||||
|
||||
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 }
|
||||
/>
|
||||
) ) }
|
||||
</Action>
|
||||
);
|
||||
|
||||
export default ControlRadioGroup;
|
|
@ -0,0 +1,11 @@
|
|||
import { Action } from '../Elements';
|
||||
|
||||
const ControlStaticValue = ( { value } ) => {
|
||||
return (
|
||||
<Action>
|
||||
<div className="ppcp--static-value">{ value }</div>
|
||||
</Action>
|
||||
);
|
||||
};
|
||||
|
||||
export default ControlStaticValue;
|
|
@ -0,0 +1,24 @@
|
|||
import { TextControl } from '@wordpress/components';
|
||||
|
||||
import { Action, Description } from '../Elements';
|
||||
|
||||
const ControlTextInput = ( {
|
||||
value,
|
||||
description,
|
||||
onChange,
|
||||
placeholder = '',
|
||||
} ) => {
|
||||
return (
|
||||
<Action>
|
||||
<TextControl
|
||||
className="ppcp-r-vertical-text-control"
|
||||
placeholder={ placeholder }
|
||||
value={ value }
|
||||
onChange={ onChange }
|
||||
/>
|
||||
<Description>{ description }</Description>
|
||||
</Action>
|
||||
);
|
||||
};
|
||||
|
||||
export default ControlTextInput;
|
|
@ -0,0 +1,23 @@
|
|||
import { ToggleControl } from '@wordpress/components';
|
||||
import { Action, Description } from '../Elements';
|
||||
|
||||
const ControlToggleButton = ( { label, description, value, onChange } ) => {
|
||||
const descriptionContent = description ? (
|
||||
<Description>{ description }</Description>
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<Action>
|
||||
<ToggleControl
|
||||
className="ppcp--control-toggle"
|
||||
__nextHasNoMarginBottom={ true }
|
||||
checked={ value }
|
||||
onChange={ onChange }
|
||||
label={ label }
|
||||
help={ descriptionContent }
|
||||
/>
|
||||
</Action>
|
||||
);
|
||||
};
|
||||
|
||||
export default ControlToggleButton;
|
|
@ -0,0 +1,5 @@
|
|||
export { default as ControlStaticValue } from './ControlStaticValue';
|
||||
export { default as ControlTextInput } from './ControlTextInput';
|
||||
export { default as ControlToggleButton } from './ControlToggleButton';
|
||||
export { default as ControlButton } from './ControlButton';
|
||||
export { default as ControlRadioGroup } from './ControlRadioGroup';
|
Loading…
Add table
Add a link
Reference in a new issue