♻️ Migrate InputSettings to ControlTextInput

This commit is contained in:
Philipp Stracker 2025-01-22 15:32:22 +01:00
parent 2f79a9fe4d
commit f90ab656f5
No known key found for this signature in database
6 changed files with 62 additions and 71 deletions

View file

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

View file

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

View file

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