11import { useFieldArray } from 'react-hook-form' ;
22import { defineMessages , FormattedMessage } from 'react-intl' ;
3- import { Card , CardContent , CardHeader , Typography } from '@mui/material' ;
3+ import { Card , CardContent , CardHeader , Chip , Typography } from '@mui/material' ;
44import { red } from '@mui/material/colors' ;
55import PropTypes from 'prop-types' ;
66
7+ import useTranslation from 'lib/hooks/useTranslation' ;
8+ import formTranslations from 'lib/translations/form' ;
9+
710import ResponseAnswer from './ResponseAnswer' ;
811
912const styles = {
@@ -27,6 +30,7 @@ const translations = defineMessages({
2730} ) ;
2831
2932const ResponseSection = ( props ) => {
33+ const { t } = useTranslation ( ) ;
3034 const { control, disabled, section, sectionIndex } = props ;
3135 const { fields : questionFields } = useFieldArray ( {
3236 control,
@@ -49,10 +53,24 @@ const ResponseSection = (props) => {
4953 < CardContent >
5054 { questionFields . map ( ( question , questionIndex ) => (
5155 < Card key = { question . id } style = { styles . questionCard } >
52- < CardContent >
56+ < CardContent className = "relative" >
57+ < div className = "absolute -left-5 top-6 flex items-center justify-center rounded-full wh-10 bg-neutral-500" >
58+ < Typography color = "white" variant = "body2" >
59+ { questionIndex + 1 }
60+ </ Typography >
61+ </ div >
62+ { question . required && (
63+ < Chip
64+ color = "error"
65+ label = { t ( formTranslations . starRequired ) }
66+ size = "small"
67+ variant = "outlined"
68+ />
69+ ) }
5370 < Typography
71+ component = "div"
5472 dangerouslySetInnerHTML = { {
55- __html : ` ${ questionIndex + 1 } . ${ question . description } ` ,
73+ __html : question . description ,
5674 } }
5775 variant = "body2"
5876 />
0 commit comments