Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(application-system): empty title for formStepper #15185

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 46 additions & 31 deletions libs/application/ui-shell/src/components/FormStepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,25 @@ const FormStepper = ({
childrenToParse.push(child)
})

return childrenToParse.map((child, i) => {
const isChildActive =
isParentActive && currentScreen.subSectionIndex === i

return (
<Text
variant="medium"
fontWeight={isChildActive ? 'semiBold' : 'regular'}
key={`formStepperChild-${i}`}
>
{formatText(child.title, application, formatMessage)}
</Text>
)
})
return childrenToParse
.map((child, i) => {
const isChildActive =
isParentActive && currentScreen.subSectionIndex === i
const childText = formatText(child.title, application, formatMessage)

if (!childText) return null

return (
<Text
variant="medium"
fontWeight={isChildActive ? 'semiBold' : 'regular'}
key={`formStepperChild-${i}`}
jonnigs marked this conversation as resolved.
Show resolved Hide resolved
>
{childText}
</Text>
)
})
jonnigs marked this conversation as resolved.
Show resolved Hide resolved
.filter(Boolean as unknown as ExcludesFalse)
}

const stepperTitle = isMobile ? null : (
Expand All @@ -85,23 +90,33 @@ const FormStepper = ({
sections &&
[
stepperTitle,
...sections.map((section, i) => (
<Section
key={`formStepper-${i}`}
isActive={currentScreen.sectionIndex === i}
section={formatText(section.title, application, formatMessage)}
sectionIndex={i}
subSections={
section.children.length > 1
? parseSubsections(
section.children,
currentScreen.sectionIndex === i,
)
: undefined
}
isComplete={currentScreen.sectionIndex > i}
/>
)),
...sections.map((section, i) => {
const sectionTitle = formatText(
section.title,
application,
formatMessage,
)

if (!sectionTitle) return null

return (
<Section
key={`formStepper-${i}`}
jonnigs marked this conversation as resolved.
Show resolved Hide resolved
isActive={currentScreen.sectionIndex === i}
section={sectionTitle}
sectionIndex={i}
subSections={
section.children.length > 1
? parseSubsections(
section.children,
currentScreen.sectionIndex === i,
)
: undefined
}
isComplete={currentScreen.sectionIndex > i}
/>
)
}),
].filter(Boolean as unknown as ExcludesFalse)
}
/>
Expand Down
Loading