Skip to content
Snippets Groups Projects
Commit b53bb288 authored by Rémi PAPIN's avatar Rémi PAPIN
Browse files

Merge branch 'features/quiz-presentation' of...

Merge branch 'features/quiz-presentation' of https://forge.grandlyon.com/web-et-numerique/llle_project/ecolyo into features/quiz-presentation
parents 6fa3532f c9fa0d7b
No related branches found
No related tags found
1 merge request!171Features/quiz presentation
import React, { useEffect } from 'react' import React, { useEffect } from 'react'
import './quizQuestion.scss' import './quizQuestion.scss'
import StyledCard from 'components/CommonKit/Card/StyledCard' import { UserChallenge } from 'models'
import StyledStopButton from 'components/CommonKit/Button/StyledStopButton'
const QuizQuestion: React.FC = ({}) => { interface QuizQuestion {
userChallenge: UserChallenge
}
const QuizQuestion: React.FC<QuizQuestion> = ({
userChallenge,
}: QuizQuestion) => {
const validateQuestion = () => {
console.log('open modal')
}
useEffect(() => {
console.log(userChallenge.quiz.questions[0])
}, [])
return ( return (
<> <>
<StyledCard> <div>
<p>{question}/5</p> <p>1/5</p>
<p>{question}</p> <p>{userChallenge.quiz.questions[0].questionLabel}</p>
<div className="answers"> {userChallenge.quiz.questions[0].answers.map((answer, index) => {
{answers.map((answer, index) => { return (
;<StyledStopButton <React.Fragment key={index}>
key={index} <input type="radio" id={`answer${index}`} name={'answer'} />
color="secondary" <label htmlFor={`answer${index}`}>{answer.answerLabel}</label>
onClick={handleValidate} </React.Fragment>
> )
{answer} })}
</StyledStopButton> </div>
})} <button className="secondary" onClick={validateQuestion}>
</div>
</StyledCard>
<StyledStopButton color="secondary" onClick={handleValidate}>
valider valider
</StyledStopButton> </button>
</> </>
) )
} }
......
...@@ -27,7 +27,7 @@ const QuizView: React.FC = () => { ...@@ -27,7 +27,7 @@ const QuizView: React.FC = () => {
case QuizState.LOCKED: case QuizState.LOCKED:
return <QuizBegin userChallenge={challenge} /> return <QuizBegin userChallenge={challenge} />
case QuizState.ONGOING: case QuizState.ONGOING:
return <QuizQuestion /> return <QuizQuestion userChallenge={challenge} />
case QuizState.DONE: case QuizState.DONE:
return <QuizFinish userChallenge={challenge} /> return <QuizFinish userChallenge={challenge} />
default: default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment