fix(ui): only render header dom node if needed (#9742)
### What? The `<header>` dom node was rendering even if empty for group fields. Causing extra margin to be added even if no label/description were provided. ### Why? If the field had no label, description or errors it would still render. ### How? Wraps the header node in an additional condition that checks for label, description or errors before rendering the node.
This commit is contained in:
@@ -71,6 +71,7 @@ export const GroupFieldComponent: GroupFieldClientComponent = (props) => {
|
||||
>
|
||||
<GroupProvider>
|
||||
<div className={`${baseClass}__wrap`}>
|
||||
{Boolean(Label || Description || label || fieldHasErrors) && (
|
||||
<div className={`${baseClass}__header`}>
|
||||
{Boolean(Label || Description || label) && (
|
||||
<header>
|
||||
@@ -96,6 +97,7 @@ export const GroupFieldComponent: GroupFieldClientComponent = (props) => {
|
||||
)}
|
||||
{fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}
|
||||
</div>
|
||||
)}
|
||||
{BeforeInput}
|
||||
<RenderFields
|
||||
fields={fields}
|
||||
|
||||
Reference in New Issue
Block a user