From 2fdf1d929ee05eff73f87da2e3c12f01fc73d78f Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 6 Dec 2023 12:58:50 -0700 Subject: [PATCH] add individual headers for all questions --- src/Assets/questions.tsx | 31 +++++++++++----- .../QuestionComponentContainer.js | 36 +++---------------- src/Types/Questions.ts | 2 +- 3 files changed, 28 insertions(+), 41 deletions(-) diff --git a/src/Assets/questions.tsx b/src/Assets/questions.tsx index 709527968..6e3125103 100644 --- a/src/Assets/questions.tsx +++ b/src/Assets/questions.tsx @@ -25,6 +25,7 @@ import type { QuestionName, Question } from '../Types/Questions.ts'; const questions: Record = { zipcode: { name: 'zipcode', + header: , question: , componentDetails: { componentType: 'Textfield', @@ -59,10 +60,10 @@ const questions: Record = { }, }, ], - headerType: 'aboutHousehold', }, householdSize: { name: 'householdSize', + header: , question: ( = { inputError: householdSizeHasError, inputHelperText: displayHouseholdSizeHelperText, }, - headerType: 'aboutHousehold', }, householdData: { name: 'householdData', @@ -95,6 +95,7 @@ const questions: Record = { }, hasExpenses: { name: 'hasExpenses', + header: , question: , questionDescription: ( = { }, }, ], - headerType: 'aboutHousehold', }, householdAssets: { name: 'householdAssets', + header: , question: ( = { inputHelperText: displayHouseholdAssetsHelperText, dollarField: true, }, - headerType: 'aboutHousehold', }, hasBenefits: { name: 'hasBenefits', + header: ( + + ), question: ( ), @@ -189,10 +195,15 @@ const questions: Record = { }, }, ], - headerType: 'aboutHousehold', }, acuteHHConditions: { name: 'acuteHHConditions', + header: ( + + ), question: ( = { options: acuteConditionOptions, inputError: acuteHHConditionsHasError, }, - headerType: 'aboutHousehold', }, referralSource: { name: 'referralSource', + header: , question: ( ), @@ -249,10 +260,15 @@ const questions: Record = { }, }, ], - headerType: 'aboutHousehold', }, signUpInfo: { name: 'signUpInfo', + header: ( + + ), question: ( ), @@ -275,7 +291,6 @@ const questions: Record = { }, }, ], - headerType: 'signUpInfo', }, }; diff --git a/src/Components/QuestionComponentContainer/QuestionComponentContainer.js b/src/Components/QuestionComponentContainer/QuestionComponentContainer.js index 8ec7c22c6..bb266ef41 100644 --- a/src/Components/QuestionComponentContainer/QuestionComponentContainer.js +++ b/src/Components/QuestionComponentContainer/QuestionComponentContainer.js @@ -175,39 +175,11 @@ const QuestionComponentContainer = ({ }; const renderHeaderAndSubheader = () => { - if (matchingQuestion.headerType === 'signUpInfo') { - return ( -

- -

- ); - } else if (matchingQuestion.headerType === 'aboutHousehold') { - if (matchingQuestion.name === 'hasBenefits' || matchingQuestion.name === 'acuteHHConditions') { - return ( -

- -

- ); - } else if (matchingQuestion.name === 'referralSource') { - return ( -

- -

- ); - } else { - return ( -

- -

- ); - } + if (matchingQuestion.header === undefined) { + return <>; } + + return

{matchingQuestion.header}

; }; return ( diff --git a/src/Types/Questions.ts b/src/Types/Questions.ts index 731a0df5f..b5be6466f 100644 --- a/src/Types/Questions.ts +++ b/src/Types/Questions.ts @@ -133,6 +133,6 @@ export type Question = { question?: FormattedMessageType; questionDescription?: FormattedMessageType; componentDetails: ComponentDetails; - headerType?: string; + header?: FormattedMessageType; followUpQuestions?: Question[]; };