import { FormLabel } from '@automattic/components'; import { useI18n } from '@wordpress/react-i18n'; import { ChangeEvent } from 'react'; import FormFieldset from 'calypso/components/forms/form-fieldset'; import FormSettingExplanation from 'calypso/components/forms/form-setting-explanation'; import FormTextInput from 'calypso/components/forms/form-text-input'; interface TargetDirInputProps { onChange( value: string ): void; value: string; } export const TargetDirInput = ( { onChange, value }: TargetDirInputProps ) => { const { __ } = useI18n(); return ( { __( 'Destination directory' ) } ) => { let targetDir = event.currentTarget.value.trim(); targetDir = targetDir.startsWith( '/' ) ? targetDir : `/${ targetDir }`; onChange( targetDir ); } } /> { __( 'This path is relative to the server root' ) } ); };