import { useRef, useEffect } from "react"; import { Box, Button, Stack, Typography } from "@mui/material"; import { useTheme } from "@emotion/react"; import TextInput from "../../../../Components/Inputs/TextInput"; import PropTypes from "prop-types"; /** * Renders the email step of the login process which includes an email field. * * @param {Object} props * @param {Object} props.form - Form state object. * @param {Object} props.errors - Object containing form validation errors. * @param {Function} props.onSubmit - Callback function to handle form submission. * @param {Function} props.onChange - Callback function to handle form input changes. * @param {Function} props.onBack - Callback function to handle "Back" button click. * @returns {JSX.Element} */ const EmailStep = ({ form, errors, onSubmit, onChange }) => { const theme = useTheme(); const inputRef = useRef(null); useEffect(() => { if (inputRef.current) { inputRef.current.focus(); } }, []); return ( <> Log In Enter your email address (e.target.value = e.target.value.toLowerCase())} onChange={onChange} error={errors.email ? true : false} helperText={errors.email} ref={inputRef} /> ); }; EmailStep.propTypes = { form: PropTypes.object.isRequired, errors: PropTypes.object.isRequired, onSubmit: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired, }; export default EmailStep;