mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
🎨 Minor code simplification
This commit is contained in:
parent
7f861c5825
commit
00b720088a
3 changed files with 30 additions and 38 deletions
|
@ -1,11 +1,9 @@
|
|||
import { Action } from '../Elements';
|
||||
|
||||
const ControlStaticValue = ( { value } ) => {
|
||||
return (
|
||||
<Action>
|
||||
<div className="ppcp--static-value">{ value }</div>
|
||||
</Action>
|
||||
);
|
||||
};
|
||||
const ControlStaticValue = ( { value } ) => (
|
||||
<Action>
|
||||
<div className="ppcp--static-value">{ value }</div>
|
||||
</Action>
|
||||
);
|
||||
|
||||
export default ControlStaticValue;
|
||||
|
|
|
@ -7,18 +7,16 @@ const ControlTextInput = ( {
|
|||
description,
|
||||
onChange,
|
||||
placeholder = '',
|
||||
} ) => {
|
||||
return (
|
||||
<Action>
|
||||
<TextControl
|
||||
className="ppcp-r-vertical-text-control"
|
||||
placeholder={ placeholder }
|
||||
value={ value }
|
||||
onChange={ onChange }
|
||||
/>
|
||||
<Description>{ description }</Description>
|
||||
</Action>
|
||||
);
|
||||
};
|
||||
} ) => (
|
||||
<Action>
|
||||
<TextControl
|
||||
className="ppcp-r-vertical-text-control"
|
||||
placeholder={ placeholder }
|
||||
value={ value }
|
||||
onChange={ onChange }
|
||||
/>
|
||||
<Description>{ description }</Description>
|
||||
</Action>
|
||||
);
|
||||
|
||||
export default ControlTextInput;
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
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>
|
||||
);
|
||||
};
|
||||
const ControlToggleButton = ( { label, description, value, onChange } ) => (
|
||||
<Action>
|
||||
<ToggleControl
|
||||
className="ppcp--control-toggle"
|
||||
__nextHasNoMarginBottom={ true }
|
||||
checked={ value }
|
||||
onChange={ onChange }
|
||||
label={ label }
|
||||
help={
|
||||
description ? <Description>{ description }</Description> : null
|
||||
}
|
||||
/>
|
||||
</Action>
|
||||
);
|
||||
|
||||
export default ControlToggleButton;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue