woocommerce/plugins/woocommerce-admin/client/settings/components/input.js

26 lines
593 B
JavaScript
Raw Normal View History

2024-06-03 11:15:11 +00:00
/**
* External dependencies
*/
import { __experimentalInputControl as InputControl } from '@wordpress/components';
import { useState } from '@wordpress/element';
2024-06-03 11:53:03 +00:00
export const SettingsInput = ( { setting } ) => {
2024-06-03 11:15:11 +00:00
const { id, desc } = setting;
const [ value, setValue ] = useState( setting.value );
const onChange = ( value ) => {
setValue( value );
};
return (
<div className="woocommerce-settings-element">
<h4>{ setting.title }</h4>
<InputControl
id={ id }
label={ desc }
onChange={ onChange }
type={ setting.type }
value={ value }
/>
</div>
);
};