From f90ab656f5645ef3327545cf203da88d09d6e278 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Wed, 22 Jan 2025 15:32:22 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Migrate=20InputSettings=20?= =?UTF-8?q?to=20ControlTextInput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettingsBlocks/ControlTextInput.js | 18 +++++++ .../SettingsBlocks/InputSettingsBlock.js | 37 -------------- .../SettingsBlocks/index.js | 3 +- .../Blocks/ConnectionDetails.js | 6 +-- .../Blocks/PaypalSettings.js | 49 ++++++++++--------- .../Settings/Blocks/InvoicePrefix.js | 20 +++++--- 6 files changed, 62 insertions(+), 71 deletions(-) create mode 100644 modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ControlTextInput.js delete mode 100644 modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/InputSettingsBlock.js diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ControlTextInput.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ControlTextInput.js new file mode 100644 index 000000000..08e6a8d11 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ControlTextInput.js @@ -0,0 +1,18 @@ +import { TextControl } from '@wordpress/components'; + +import { Action } from '../Elements'; + +const ControlTextInput = ( { value, onChange, placeholder = '' } ) => { + return ( + + + + ); +}; + +export default ControlTextInput; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/InputSettingsBlock.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/InputSettingsBlock.js deleted file mode 100644 index 21cc53887..000000000 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/InputSettingsBlock.js +++ /dev/null @@ -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 }; - - return ( - - - { title } - <TitleExtra>{ supplementaryLabel }</TitleExtra> - - { showDescriptionFirst && TheDescription } - - - - { ! showDescriptionFirst && TheDescription } - - ); -}; - -export default InputSettingsBlock; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js index cb06265c4..048c09ca1 100644 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js @@ -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'; diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/ConnectionDetails.js b/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/ConnectionDetails.js index 144f9a55b..224b5dbd0 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/ConnectionDetails.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/ConnectionDetails.js @@ -3,7 +3,7 @@ import { Button } from '@wordpress/components'; import { AccordionSettingsBlock, - InputSettingsBlock, + ControlTextInput, RadioSettingsBlock, } from '../../../../ReusableComponents/SettingsBlocks'; @@ -80,7 +80,7 @@ const generateOptions = ( config, settings, updateFormValue ) => [ ), additionalContent: ( <> - [ 'woocommerce-paypal-payments' ) } /> - { return ( @@ -81,37 +82,39 @@ const PaypalSettings = ( { updateFormValue, settings } ) => { } } /> - + > + + - + > + + { const { invoicePrefix, setInvoicePrefix } = SettingsHooks.useSettings(); return ( - + > + + ); };