import { Button } from '@wordpress/components'; import { Icon, info } from '@wordpress/icons'; import clsx from 'clsx'; import { useTranslate } from 'i18n-calypso'; import { FormEvent, KeyboardEvent } from 'react'; import './styles.scss'; interface Props { domain?: string; isBusy?: boolean; isBusyForWhile?: boolean; isDomainValid?: boolean; domainFetchingError?: Error; onFormSubmit: ( domain: string ) => void; } export default function DomainAnalyzer( props: Props ) { const translate = useTranslate(); const { domain, isBusy, isBusyForWhile, isDomainValid, domainFetchingError, onFormSubmit } = props; const showError = isDomainValid === false || domainFetchingError; const onSubmit = ( e: FormEvent< HTMLFormElement > ) => { e.preventDefault(); const domainEl = e.currentTarget.elements.namedItem( 'domain' ) as HTMLInputElement; const domain = domainEl.value; onFormSubmit( domain ); }; const onInputEscape = ( e: KeyboardEvent< HTMLInputElement > ) => { if ( e.key === 'Escape' ) { e.currentTarget.value = ''; onFormSubmit( '' ); } }; return (

{ translate( 'Site Profiler' ) }

{ translate( 'Access the essential information about any site, including hosting provider, domain details, and contact information.' ) }

{ ' ' } { isDomainValid === false && translate( 'Please enter a valid website address' ) } { domainFetchingError && domainFetchingError.message }

); }