import React, { useState } from "react"; import "./emailTextField.css"; import { InputAdornment, TextField } from "@mui/material"; import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"; import HelpOutlineIcon from "@mui/icons-material/HelpOutline"; function EmailTextField({ id, label, variant, placeholder, icon, helperText, error, }) { const [showIcon, setShowIcon] = useState(false); // State to control mouse hover effect const handleMouseEnter = () => setShowIcon(true); const handleMouseLeave = () => setShowIcon(false); return ( <>
Email
{error && showIcon && ( )} {error && !showIcon && ( )} {!error && showIcon && } ), }} helperText={helperText} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} />
); } export default EmailTextField;