Skip to content

Commit 6c112a8

Browse files
committed
quiz fix error
1 parent 59fb96d commit 6c112a8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/QuizBlock/QuizBlock.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ const QuizBlock: React.FC<IQuizBlockProps> = ({
267267

268268

269269
const handleNextQuestion = () => {
270-
if (!selectedAnswer && remainingTime > 0) {
270+
if (selectedAnswer === null && remainingTime > 0) {
271271
return;
272272
}
273273

src/components/QuizBlock/components/QuestionContainer/QuestionContainer.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ const QuestionContainer: React.FC<{ props: QuestionContainerProps }> = ({props})
5858
defaultValue={0}
5959
value={percentCompleted ? percentCompleted : 0}
6060
variant={"determinate"}/>
61-
<Typography className={"quiz_title"} variant={"h5"}>Тема: {currentArticleTitle && currentArticleTitle}</Typography>
61+
<Typography className={"quiz_title"}
62+
variant={"h5"}>Тема: {currentArticleTitle && currentArticleTitle}</Typography>
6263
<Grid container rowSpacing={{xs: 2, sm: 0}} columnSpacing={{xs: 1, sm: 2, md: 3}} alignItems={"center"}
6364
justifyContent={"center"}>
6465
<Grid item xs={12} sm={6}>
@@ -69,14 +70,14 @@ const QuestionContainer: React.FC<{ props: QuestionContainerProps }> = ({props})
6970
{(quizOptions && quizOptions.length > 0) && quizOptions[currentQuestion].map((option, index) => (
7071
<FormControlLabel
7172
key={index + "button"}
72-
className={cx(remainingTime === 0 ? optionsHighlightWhenTimerIsFinished(index + 1) : optionHighlight(index + 1))}
73+
className={cx(remainingTime === 0 ? optionsHighlightWhenTimerIsFinished(index) : optionHighlight(index))}
7374
onKeyPress={handleAnswerKeyPress}
7475
onClick={() => {
7576
if (!answerChosen && remainingTime > 0) {
76-
handleAnswer(index + 1);
77+
handleAnswer(index);
7778
}
7879
}}
79-
control={<Radio checked={selectedAnswer === index + 1}/>}
80+
control={<Radio checked={selectedAnswer === index}/>}
8081
label={option}
8182
value={option}
8283
disabled={answerChosen || remainingTime === 0}

0 commit comments

Comments
 (0)