File size: 926 Bytes
77fd7a1
 
3206d59
77fd7a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
import React, { useState } from "react";
import BaseInputField from "./BaseInputField";
import { EmailIcon } from "../../Icons/EmailIcon";

interface EmailInputFieldProps {
  label: string;
  width?: string;
  inputRef?: React.Ref<HTMLInputElement>;
  onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
}

function EmailInputField(props: Readonly<EmailInputFieldProps>) {
  const [emailValue, setEmailValue] = useState<string>("");

  function handleEmailChange(event: React.ChangeEvent<HTMLInputElement>): void {
    setEmailValue(event.target.value);
  }

  const { width = "250px" } = props;

  return (
    <BaseInputField
      label={props.label}
      value={emailValue}
      type={"email"}
      icon={EmailIcon}
      onChange={handleEmailChange}
      width={width}
      inputRef={props.inputRef}
      onKeyDown={props.onKeyDown}
      autoComplete={"email"}
    />
  );
}

export default EmailInputField;