Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/lib/Core.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ function Core({
formatTime(seconds)
}${seconds}`;
};

const submitQuiz = () => {
setIsRunning(false);
setEndQuiz(true);
getUnansweredQuestions();
}
Comment on lines +371 to +375
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code is same as handleTimeUp. don't duplicate it. revise the function and use for both case.

const handleTimeUp = () => {
setIsRunning(false);
setEndQuiz(true);
Expand Down Expand Up @@ -456,6 +460,21 @@ function Core({
/>
</div>
{activeQuestion && renderAnswers(activeQuestion, buttons)}
<div style={{display:'flex', justifyContent: 'space-between'}}>
{
!endQuiz?
<div style={{ display: 'flex',marginRight:'auto'}}>
Comment on lines +463 to +466
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use inline styles

<button
onClick={() => {submitQuiz()}}
style={{ display: 'flex', justifyContent: 'center', backgroundColor: 'green',color:'white' }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use inline styles

className="quitQuizBtn btn"
type="button"
>
Submit
</button>
</div>
:null
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply use &&

}
{(showNextQuestionButton || allowNavigation) && (
<div className="questionBtnContainer">
{allowNavigation && currentQuestionIndex > 0 && (
Expand All @@ -477,6 +496,7 @@ function Core({
</button>
</div>
)}
</div>
</>
) : (
<span className="timerPauseScreen dark:text-white text-black">
Expand Down