Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ecolyo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
Ecolyo
Commits
cbc63d54
Commit
cbc63d54
authored
3 years ago
by
Guilhem CARRON
Browse files
Options
Downloads
Patches
Plain Diff
Fix explanation modal overlap
parent
5e4a7d00
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!360
Fix explanation modal overlap
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/Quiz/QuizQuestionContent.tsx
+23
-21
23 additions, 21 deletions
src/components/Quiz/QuizQuestionContent.tsx
with
23 additions
and
21 deletions
src/components/Quiz/QuizQuestionContent.tsx
+
23
−
21
View file @
cbc63d54
import
React
,
{
Dispatch
,
SetStateAction
,
use
Effect
,
useState
}
from
'
react
'
import
React
,
{
Dispatch
,
SetStateAction
,
use
Callback
,
useState
}
from
'
react
'
import
'
./quizQuestion.scss
'
import
CloseIcon
from
'
assets/icons/ico/close.svg
'
import
StyledIconButton
from
'
components/CommonKit/IconButton/StyledIconButton
'
...
...
@@ -34,7 +34,6 @@ const QuizQuestionContent: React.FC<QuizQuestionContent> = ({
const
[
questionIndex
,
setQuestionIndex
]
=
useState
<
number
>
(
questionIndexLocked
)
const
[
enableNextQuest
,
setEnableNextQuest
]
=
useState
<
boolean
>
(
false
)
const
client
:
Client
=
useClient
()
const
dispatch
=
useDispatch
()
...
...
@@ -67,23 +66,24 @@ const QuizQuestionContent: React.FC<QuizQuestionContent> = ({
const
handleChange
=
(
e
:
React
.
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setUserChoice
(
e
.
target
.
value
)
}
const
goNextQuestion
=
async
()
=>
{
setEnableNextQuest
(
true
)
const
goNextQuestion
=
useCallback
(()
=>
{
setUserChoice
(
''
)
setOpenModal
(
false
)
if
(
questionIndex
===
userChallenge
.
quiz
.
questions
.
length
-
1
)
{
setIsCustomQuest
(
true
)
}
}
useEffect
(()
=>
{
if
(
enableNextQuest
)
{
if
(
questionIndex
!==
userChallenge
.
quiz
.
questions
.
length
-
1
)
{
setQuestionIndex
(
questionIndex
+
1
)
}
setEnableNextQuest
(
false
)
setUserChoice
(
''
)
if
(
questionIndex
!==
userChallenge
.
quiz
.
questions
.
length
-
1
)
{
setQuestionIndex
(
questionIndex
+
1
)
}
},
[
enableNextQuest
,
questionIndex
,
userChallenge
,
userChoice
])
},
[
questionIndex
,
setIsCustomQuest
,
setQuestionIndex
,
setUserChoice
,
setOpenModal
,
userChallenge
.
quiz
.
questions
.
length
,
])
return
(
<
div
className
=
"quiz-container"
>
<
div
className
=
"question-container"
>
...
...
@@ -127,13 +127,15 @@ const QuizQuestionContent: React.FC<QuizQuestionContent> = ({
{
t
(
'
quiz.button_validate
'
)
}
</
Button
>
)
}
<
QuizExplanationModal
open
=
{
openModal
}
answerIndex
=
{
answerIndex
}
question
=
{
userChallenge
.
quiz
.
questions
[
questionIndex
]
}
goNext
=
{
goNextQuestion
}
handleCloseClick
=
{
()
=>
setOpenModal
(
false
)
}
/>
{
openModal
&&
(
<
QuizExplanationModal
open
=
{
openModal
}
answerIndex
=
{
answerIndex
}
question
=
{
userChallenge
.
quiz
.
questions
[
questionIndex
]
}
goNext
=
{
goNextQuestion
}
handleCloseClick
=
{
()
=>
setOpenModal
(
false
)
}
/>
)
}
</
div
>
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment