Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into 27-add-eoh-design-as-background
  • Loading branch information
BrownGitHlungwani committed Sep 18, 2024
1 parent a150c39 commit e5cf022
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/src/components/QuizCards/QuizComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ export const QuizComponent: React.FC<FileDetailProps> = ({ files }) => {
const timerRef = useRef<NodeJS.Timeout | null>(null);

useEffect(() => {
if (timeLeft === 0) {
moveToNextQuestion();
return;
}


timerRef.current = setInterval(() => {
setTimeLeft((prevTime) => prevTime - 1);
}, 1000);
Expand Down Expand Up @@ -75,6 +71,12 @@ export const QuizComponent: React.FC<FileDetailProps> = ({ files }) => {
if (timerRef.current) clearInterval(timerRef.current);
};

if (timeLeft === 0) {
moveToNextQuestion();
return;
}


const handleAnswerCheck = (option: string) => {
setSelectedOption(option);
setShowAnswer(true);
Expand Down

0 comments on commit e5cf022

Please sign in to comment.