@@ -2,6 +2,7 @@ import { FC } from 'react';
2
2
import { useTranslation } from 'react-i18next' ;
3
3
import { Answers , SelectQuestion } from 'types/configuration' ;
4
4
import { answersFrom } from 'types/getObjectType' ;
5
+ import HintButton from 'components/buttons/HintButton' ;
5
6
6
7
type SelectProps = {
7
8
select : SelectQuestion ;
@@ -33,26 +34,26 @@ const Select: FC<SelectProps> = ({ select, answers, setAnswers }) => {
33
34
setAnswers ( newAnswers ) ;
34
35
} ;
35
36
36
- const hintDisplay = ( ) => {
37
- let hint = '' ;
37
+ const requirementsDisplay = ( ) => {
38
+ let requirements = '' ;
38
39
const max = select . MaxN ;
39
40
const min = select . MinN ;
40
41
41
42
if ( max === min ) {
42
- hint =
43
+ requirements =
43
44
max > 1
44
45
? t ( 'selectMin' , { minSelect : min , singularPlural : t ( 'pluralAnswers' ) } )
45
46
: t ( 'selectMin' , { minSelect : min , singularPlural : t ( 'singularAnswer' ) } ) ;
46
47
} else if ( min === 0 ) {
47
- hint =
48
+ requirements =
48
49
max > 1
49
50
? t ( 'selectMax' , { maxSelect : max , singularPlural : t ( 'pluralAnswers' ) } )
50
51
: t ( 'selectMax' , { maxSelect : max , singularPlural : t ( 'singularAnswer' ) } ) ;
51
52
} else {
52
- hint = t ( 'selectBetween' , { minSelect : min , maxSelect : max } ) ;
53
+ requirements = t ( 'selectBetween' , { minSelect : min , maxSelect : max } ) ;
53
54
}
54
55
55
- return < div className = "text-sm pl-2 pb-2 sm:pl-4 text-gray-400" > { hint } </ div > ;
56
+ return < div className = "text-sm pl-2 pb-2 sm:pl-4 text-gray-400" > { requirements } </ div > ;
56
57
} ;
57
58
58
59
const choiceDisplay = ( isChecked : boolean , choice : string , choiceIndex : number ) => {
@@ -75,9 +76,16 @@ const Select: FC<SelectProps> = ({ select, answers, setAnswers }) => {
75
76
76
77
return (
77
78
< div >
78
- < h3 className = "text-lg break-words text-gray-600" > { select . Title } </ h3 >
79
- { hintDisplay ( ) }
80
- < div className = "sm:pl-8 pl-6" >
79
+ < div className = "grid grid-rows-1 grid-flow-col" >
80
+ < div >
81
+ < h3 className = "text-lg break-words text-gray-600 w-96" > { select . Title } </ h3 >
82
+ </ div >
83
+ < div >
84
+ < HintButton text = { select . Hint } />
85
+ </ div >
86
+ </ div >
87
+ < div className = "pt-1" > { requirementsDisplay ( ) } </ div >
88
+ < div className = "sm:pl-8 mt-2 pl-6" >
81
89
{ Array . from ( answers . SelectAnswers . get ( select . ID ) . entries ( ) ) . map (
82
90
( [ choiceIndex , isChecked ] ) =>
83
91
choiceDisplay ( isChecked , select . Choices [ choiceIndex ] , choiceIndex )
0 commit comments