mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
♻️ Migrate InputSettings to ControlTextInput
This commit is contained in:
parent
2f79a9fe4d
commit
f90ab656f5
6 changed files with 62 additions and 71 deletions
|
@ -0,0 +1,18 @@
|
|||
import { TextControl } from '@wordpress/components';
|
||||
|
||||
import { Action } from '../Elements';
|
||||
|
||||
const ControlTextInput = ( { value, onChange, placeholder = '' } ) => {
|
||||
return (
|
||||
<Action>
|
||||
<TextControl
|
||||
className="ppcp-r-vertical-text-control"
|
||||
placeholder={ placeholder }
|
||||
value={ value }
|
||||
onChange={ onChange }
|
||||
/>
|
||||
</Action>
|
||||
);
|
||||
};
|
||||
|
||||
export default ControlTextInput;
|
|
@ -1,37 +0,0 @@
|
|||
import { TextControl } from '@wordpress/components';
|
||||
|
||||
import SettingsBlock from '../SettingsBlock';
|
||||
import { Title, Action, Description, TitleExtra } from '../Elements';
|
||||
|
||||
const InputSettingsBlock = ( {
|
||||
title,
|
||||
description,
|
||||
supplementaryLabel,
|
||||
showDescriptionFirst = false,
|
||||
value,
|
||||
onChange,
|
||||
placeholder = '',
|
||||
} ) => {
|
||||
const TheDescription = <Description>{ description }</Description>;
|
||||
|
||||
return (
|
||||
<SettingsBlock className="ppcp-r-settings-block__input">
|
||||
<Title>
|
||||
{ title }
|
||||
<TitleExtra>{ supplementaryLabel }</TitleExtra>
|
||||
</Title>
|
||||
{ showDescriptionFirst && TheDescription }
|
||||
<Action>
|
||||
<TextControl
|
||||
className="ppcp-r-vertical-text-control"
|
||||
placeholder={ placeholder }
|
||||
value={ value }
|
||||
onChange={ onChange }
|
||||
/>
|
||||
</Action>
|
||||
{ ! showDescriptionFirst && TheDescription }
|
||||
</SettingsBlock>
|
||||
);
|
||||
};
|
||||
|
||||
export default InputSettingsBlock;
|
|
@ -1,8 +1,9 @@
|
|||
export { default as ButtonSettingsBlock } from './ButtonSettingsBlock';
|
||||
export { default as InputSettingsBlock } from './InputSettingsBlock';
|
||||
export { default as SelectSettingsBlock } from './SelectSettingsBlock';
|
||||
export { default as AccordionSettingsBlock } from './AccordionSettingsBlock';
|
||||
export { default as ToggleSettingsBlock } from './ToggleSettingsBlock';
|
||||
export { default as RadioSettingsBlock } from './RadioSettingsBlock';
|
||||
export { default as PaymentMethodsBlock } from './PaymentMethodsBlock';
|
||||
export { default as PaymentMethodItemBlock } from './PaymentMethodItemBlock';
|
||||
|
||||
export { default as ControlTextInput } from './ControlTextInput';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue