Add 'Back' button to QuizRunner component
This commit is contained in:
@@ -445,11 +445,18 @@ export default function QuizRunner({ defaultMode = 'all', defaultEntryId, autoSt
|
||||
}
|
||||
|
||||
if (status === 'finished') {
|
||||
const lastIndex = questions.length ? questions.length - 1 : 0;
|
||||
return (
|
||||
<div className="quiz-finished">
|
||||
<h2>Nice work!</h2>
|
||||
<p className="muted">You scored {score} out of {questions.length}.</p>
|
||||
<div className="actions">
|
||||
<button className="button button--ghost" onClick={() => {
|
||||
setStatus('running');
|
||||
setCurrentIndex(lastIndex);
|
||||
}}>
|
||||
Back
|
||||
</button>
|
||||
<button className="button" onClick={startQuiz}>
|
||||
Play again
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user