From cbb3dbc4f52089d4b22e4fbc191adb0c2cdaed18 Mon Sep 17 00:00:00 2001 From: Xavier Desoindre Date: Tue, 10 Dec 2024 18:22:56 +0100 Subject: [PATCH] chore: review accessibility on quiz (#759) --- src/components/outils/quiz/Answer.tsx | 1 - src/components/outils/quiz/QuizSimulator.tsx | 288 ++++++++++--------- 2 files changed, 147 insertions(+), 142 deletions(-) diff --git a/src/components/outils/quiz/Answer.tsx b/src/components/outils/quiz/Answer.tsx index 80d06dc1b..8a763b883 100644 --- a/src/components/outils/quiz/Answer.tsx +++ b/src/components/outils/quiz/Answer.tsx @@ -1,7 +1,6 @@ 'use client' import classNames from 'classnames' -import React from 'react' import useParamContext from 'src/providers/ParamProvider' import { ComputedEquivalent } from 'types/equivalent' import { getName } from 'utils/Equivalent/equivalent' diff --git a/src/components/outils/quiz/QuizSimulator.tsx b/src/components/outils/quiz/QuizSimulator.tsx index d4bf0d3ea..5d49f3f64 100644 --- a/src/components/outils/quiz/QuizSimulator.tsx +++ b/src/components/outils/quiz/QuizSimulator.tsx @@ -55,154 +55,160 @@ const QuizSimulator = () => { return ( <> -
- {question > 0 && config && ( - - )} -

- {config ? ( - <> - {t('question')} {question + 1} / 10 - - ) : ( - t('finished') - )} -

-

- {config - ? t.rich('title') - : t.rich('score', { score: score.current.reduce((acc, current) => acc + current, 0) })} -

- {config && ( -

- {answer ? ( - answer === config.answer ? ( - t.rich('correct') - ) : ( +

+
+
+ {question > 0 && config && ( + + )} +

+ {config ? ( <> - {t.rich('missed')} {config.answer} ! + {t('question')} {question + 1} / 10 - ) - ) : ( - t('tag') + ) : ( + t('finished') + )} +

+ + {config + ? t.rich('title') + : t.rich('score', { score: score.current.reduce((acc, current) => acc + current, 0) })} + + {config && ( +

+ {answer ? ( + answer === config.answer ? ( + t.rich('correct') + ) : ( + <> + {t.rich('missed')} {config.answer} ! + + ) + ) : ( + t('tag') + )} +

)} -

- )} -
- {config ? ( -
- { - score.current[question] = answer === config.answer ? 1 : 0 - setNavigated(true) - setAnswer(undefined) - setQuestion(question + 1) - setDisplayMore(false) - }} - answer={answer} - setAnswer={setAnswer} - ref={nextRef} - displayMore={displayMore} - /> -
- ) : ( - <> -
- - -
- -
-

{t('read-more')}

- - - - -
-
- - )} - {answer && ( - +
+ +
+

{t('read-more')}

+ + + + + +
+
- )} - + )}{' '} +
+
+ {answer && ( +
+ +
)} )