From 20bad44d7e8a48ee58747ff139d9e74b744c5e79 Mon Sep 17 00:00:00 2001 From: NotAmaia <012.sva@gmail.com> Date: Sat, 25 May 2024 10:07:57 -0700 Subject: [PATCH] added wrong message to graphs --- src/components/shared/Exercises/GraphInput.tsx | 17 +++++++++++++++-- src/styles/Exercises/GraphInput.scss | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/components/shared/Exercises/GraphInput.tsx b/src/components/shared/Exercises/GraphInput.tsx index b3d9a39..bbc58e7 100644 --- a/src/components/shared/Exercises/GraphInput.tsx +++ b/src/components/shared/Exercises/GraphInput.tsx @@ -1,5 +1,5 @@ //import { useState } from 'react'; -//import { useState } from 'react'; +import { useState } from 'react'; import '../../../styles/Exercises/GraphInput.scss'; interface GraphQuestionData { @@ -105,7 +105,7 @@ function GraphInput({ //console.log(i); if (!i) { //console.log(`${i} is incorrect`); - //setWrong(true); + setWrong(true); return; } } @@ -113,6 +113,16 @@ function GraphInput({ nextExercise(); }; + function wrongMessage(isWrong: boolean) { + if (isWrong) { + return "That's not quite right. Try again!"; + } else { + return; + } + } + + const [wrong, setWrong] = useState(false); + const makeLine = ( data: GraphLineData, setCorrect: (id: number, value: boolean) => void @@ -128,6 +138,9 @@ function GraphInput({
{questionArray.map((x) => makeLine(x, setValueCorrect))}
+
+

 {wrongMessage(wrong)} 

+