2024-12-08 09:33:49 +01:00
|
|
|
import { TextControl } from '@wordpress/components';
|
2025-01-21 18:35:17 +01:00
|
|
|
|
2025-01-21 18:57:36 +01:00
|
|
|
import SettingsBlock from '../SettingsBlock';
|
|
|
|
import { Title, Action, Description, SupplementaryLabel } from '../Elements';
|
2024-12-08 09:33:49 +01:00
|
|
|
|
|
|
|
const InputSettingsBlock = ( {
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
supplementaryLabel,
|
2025-01-21 18:35:17 +01:00
|
|
|
showDescriptionFirst = false,
|
2025-01-21 19:06:53 +01:00
|
|
|
value,
|
|
|
|
onChange,
|
|
|
|
placeholder = '',
|
2025-01-21 18:35:17 +01:00
|
|
|
} ) => {
|
|
|
|
const TheDescription = <Description>{ description }</Description>;
|
|
|
|
|
|
|
|
return (
|
2025-01-21 19:06:53 +01:00
|
|
|
<SettingsBlock className="ppcp-r-settings-block__input">
|
2025-01-21 18:35:17 +01:00
|
|
|
<Title>
|
|
|
|
{ title }
|
|
|
|
{ supplementaryLabel && (
|
|
|
|
<SupplementaryLabel>
|
|
|
|
{ supplementaryLabel }
|
|
|
|
</SupplementaryLabel>
|
|
|
|
) }
|
|
|
|
</Title>
|
|
|
|
{ showDescriptionFirst && TheDescription }
|
|
|
|
<Action>
|
|
|
|
<TextControl
|
|
|
|
className="ppcp-r-vertical-text-control"
|
2025-01-21 19:06:53 +01:00
|
|
|
placeholder={ placeholder }
|
|
|
|
value={ value }
|
|
|
|
onChange={ onChange }
|
2024-12-17 11:50:32 +01:00
|
|
|
/>
|
2025-01-21 18:35:17 +01:00
|
|
|
</Action>
|
|
|
|
{ ! showDescriptionFirst && TheDescription }
|
|
|
|
</SettingsBlock>
|
|
|
|
);
|
|
|
|
};
|
2024-12-08 09:33:49 +01:00
|
|
|
|
|
|
|
export default InputSettingsBlock;
|