diff --git a/src/components/Questionnaire/QuestionTypes/ChoiceQuestion.tsx b/src/components/Questionnaire/QuestionTypes/ChoiceQuestion.tsx index cb14f07ad59..39f3b66697e 100644 --- a/src/components/Questionnaire/QuestionTypes/ChoiceQuestion.tsx +++ b/src/components/Questionnaire/QuestionTypes/ChoiceQuestion.tsx @@ -20,6 +20,7 @@ interface ChoiceQuestionProps { questionnaireResponse: QuestionnaireResponse, ) => void; disabled?: boolean; + withLabel?: boolean; clearError: () => void; index?: number; } @@ -29,6 +30,7 @@ export const ChoiceQuestion = memo(function ChoiceQuestion({ questionnaireResponse, updateQuestionnaireResponseCB, disabled = false, + withLabel = true, clearError, index = 0, }: ChoiceQuestionProps) { @@ -51,10 +53,12 @@ export const ChoiceQuestion = memo(function ChoiceQuestion({ return (
- + {withLabel && ( + + )} +
+ {question.text && ( +
+ + {question.description && ( +

+ {question.description} +

+ )} +
+ )}
- {question.text && ( -
- - {question.description && ( -

- {question.description} -

- )} -
- )} -
- {question.questions?.map((subQuestion) => ( - - ))} -
+ {question.questions?.map((subQuestion) => ( + + ))}
); diff --git a/src/components/Questionnaire/QuestionTypes/QuestionInput.tsx b/src/components/Questionnaire/QuestionTypes/QuestionInput.tsx index 340576de20e..661733bfcc7 100644 --- a/src/components/Questionnaire/QuestionTypes/QuestionInput.tsx +++ b/src/components/Questionnaire/QuestionTypes/QuestionInput.tsx @@ -72,13 +72,14 @@ export function QuestionInput({ }); }; - const renderSingleInput = (index: number = 0) => { + const renderSingleInput = (index: number = 0, withLabel: boolean = true) => { const commonProps = { classes: question.styling_metadata?.classes, question, questionnaireResponse, updateQuestionnaireResponseCB, disabled, + withLabel, clearError, index, }; @@ -159,8 +160,10 @@ export function QuestionInput({ ); return ( -
-
{renderSingleInput(index)}
+
+
+ {renderSingleInput(index, index === 0)} +
{removeButton}
); diff --git a/src/types/questionnaire/question.ts b/src/types/questionnaire/question.ts index e41fdb3498e..01f34d04b74 100644 --- a/src/types/questionnaire/question.ts +++ b/src/types/questionnaire/question.ts @@ -60,6 +60,7 @@ export interface Question { structured_type?: StructuredQuestionType; styling_metadata?: { classes?: string; + containerClasses?: string; }; required?: boolean; collect_time?: boolean;