-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
114 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import CategorySimulator from 'components/outils/CategorySimulator' | ||
import { quizEquivalents } from 'components/outils/quiz/question.config' | ||
import Shareable from 'components/shareable/Shareable' | ||
import { overScreenQuizInfographyValues } from 'components/shareable/overScreens/Values' | ||
|
||
const page = () => { | ||
return ( | ||
<Shareable slug='quiz-infographie' tracking='Quiz infographie' overScreens={overScreenQuizInfographyValues}> | ||
<CategorySimulator tracking='Quiz infographie' equivalents={quizEquivalents} reverse /> | ||
</Shareable> | ||
) | ||
} | ||
|
||
export default page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.category { | ||
padding: 2rem 1.5rem; | ||
max-height: 19.5rem; | ||
overflow: hidden; | ||
} | ||
|
||
.displayAll { | ||
max-height: none; | ||
overflow: auto; | ||
} | ||
|
||
.text { | ||
text-align: center; | ||
color: var(--neutral-50); | ||
font-size: 0.875rem; | ||
font-weight: 500; | ||
line-height: 1.5rem; | ||
text-transform: uppercase; | ||
margin-bottom: 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import classNames from 'classnames' | ||
import { useEffect, useRef, useState } from 'react' | ||
import { useTranslations } from 'use-intl' | ||
import Shareable from 'components/shareable/Shareable' | ||
import { overScreenQuizInfographyValues } from 'components/shareable/overScreens/Values' | ||
import shareableStyles from '../../shareable/Shareable.module.css' | ||
import CategoryDisplayAll from '../CategoryDisplayAll' | ||
import CategorySimulator from '../CategorySimulator' | ||
import styles from './QuizInfography.module.css' | ||
import { quizEquivalents } from './question.config' | ||
|
||
const QuizInfography = () => { | ||
const t = useTranslations('quiz') | ||
const [displayAll, setDisplayAll] = useState(false) | ||
const ref = useRef<HTMLDivElement>(null) | ||
|
||
useEffect(() => { | ||
if (ref.current) { | ||
if (displayAll) { | ||
ref.current.getElementsByTagName('a')[0].focus() | ||
} else { | ||
ref.current.getElementsByTagName('a')[0].scrollIntoView({ behavior: 'smooth', block: 'end' }) | ||
} | ||
} | ||
}, [ref, displayAll]) | ||
|
||
return ( | ||
<> | ||
<div className={shareableStyles.separatorBothBorders} /> | ||
<div | ||
className={classNames(styles.category, { [styles.displayAll]: displayAll })} | ||
inert={displayAll ? undefined : true}> | ||
<p className={styles.text}>{t('infography')}</p> | ||
<Shareable slug='quiz-infographie' tracking='Quiz infographie' overScreens={overScreenQuizInfographyValues}> | ||
<div ref={ref}> | ||
<CategorySimulator tracking='Quiz infographie' equivalents={quizEquivalents} reverse /> | ||
</div> | ||
</Shareable> | ||
</div> | ||
<CategoryDisplayAll | ||
displayAll={displayAll} | ||
setDisplayAll={setDisplayAll} | ||
tracking='Quiz infographie' | ||
displayAllText={t('displayAll')} | ||
hideAllText={t('hideAll')} | ||
/> | ||
<div className={shareableStyles.separatorBothBorders} /> | ||
</> | ||
) | ||
} | ||
|
||
export default QuizInfography |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters