All files / src/components/PCNSearch/PCNSearchForm/CompanyNameField CompanyNameField.tsx

87.5% Statements 7/8
0% Branches 0/1
100% Functions 2/2
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 313x 3x   10x 24x 21x   21x 7x                                            
import React from 'react';
import { useFormContext, Form, useI18nContext } from '@procore/core-react';
 
export function CompanyNameField() {
  const { submitForm } = useFormContext();
  const i18n = useI18nContext();
 
  const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
    Iif (e.key === 'Enter') {
      submitForm();
    }
  };
 
  return (
    <Form.Text
      name="company"
      label={i18n.t('views.generic.directory.add_company_package.search_label')}
      required
      colStart={1}
      colWidth={10}
      placeholder={i18n.t(
        'views.generic.directory.add_company_package.company_name'
      )}
      autoComplete="off"
      tabIndex={0}
      autoFocus
      onKeyDown={handleKeyDown}
    />
  );
}