import { useEffect, useRef, useState } from "react"; import styles from "../../styles/room/input.module.scss"; import { parseClassName } from "../../utils/utils.js"; import Input from "../Input.jsx"; import { AiOutlineCheck, AiOutlineClose } from "react-icons/ai"; export default function CorrectionInput({ inputData, idInput, idExo, idCalcul, correctionMenu, setCorrectionMenu, }) { const [result, setResult] = useState({ correction: inputData.correction, isCorrect: inputData.isCorrect, }); const [fade, setFade] = useState(false); useEffect(() => { if (correctionMenu) { setFade(true) } else { setFade(false); } }, [correctionMenu]); return (
{correctionMenu && (
{ e.stopPropagation(); }} type="text" value={result.correction} onChange={(e) => { setResult({ correction: e.target.value, isCorrect: inputData.value == e.target.value, }); }} />
{ e.stopPropagation(); setResult({ ...result, isCorrect: true }); }} /> { e.stopPropagation(); setResult({ ...result, isCorrect: false }); }} />{" "}
)}
{inputData.value}{" "} {result.isCorrect == false && result.correction != "" && `-> ${result.correction}`}
); }