Skip to content

Commit

Permalink
fix: balance the title
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhooks committed Nov 20, 2024
1 parent 895f5e5 commit ad6f43d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apps/total-typescript/src/offer/survey/survey-question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from './survey-machine'
import {State} from 'xstate'
import {useState} from 'react'
import Balancer from 'react-wrap-balancer'

export type FormikValues = {
answer: string | string[] | null
Expand All @@ -30,7 +31,7 @@ export type SurveyConfig = {
}
}
answerSubmitUrl?: string
questionBodyRenderer?: (question: any) => void
questionBodyRenderer?: (question: any) => React.ReactNode
}

export const SurveyQuestionContext: React.Context<InternalQuestionContextValue> =
Expand Down Expand Up @@ -137,8 +138,8 @@ const SurveyQuestionHeader = React.forwardRef(function QuestionHeader(

const {questionBodyRenderer} = config
return (
<Comp {...props} ref={forwardRef} data-sr-quiz-question-header="">
<>
<Balancer>
<Comp {...props} ref={forwardRef} data-sr-quiz-question-header="">
{children}
{questionBodyRenderer ? (
questionBodyRenderer(currentQuestion?.question)
Expand All @@ -149,8 +150,8 @@ const SurveyQuestionHeader = React.forwardRef(function QuestionHeader(
: currentQuestion?.question}
</Markdown>
)}
</>
</Comp>
</Comp>
</Balancer>
)
}) as Polymorphic.ForwardRefComponent<'legend', SurveyQuestionHeaderProps>

Expand Down

0 comments on commit ad6f43d

Please sign in to comment.