import { __ } from '@wordpress/i18n'; import type { JSX } from 'react'; import { Button } from '../../shared/ui/Button'; import { useAutofocus } from '../../shared/ui/useAutofocus'; const ADDRESS_FIELD_ID = 'lcu-new-url'; const REDIRECT_PLACEHOLDER = '/new-page/'; const ADDRESS_PLACEHOLDER = 'https://'; type AddressFieldProps = { isRedirect: boolean; address: string; isChecking: boolean; onType: ( typedAddress: string ) => void; onTest: () => void; }; export function AddressField( { isRedirect, address, isChecking, onType, onTest, }: AddressFieldProps ): JSX.Element { const autofocus = useAutofocus< HTMLInputElement >(); return (
{ onType( event.target.value ); } } onKeyDown={ ( event ) => { if ( event.key === 'Enter' ) { onTest(); } } } />
); }