Skip to content

Commit 84faf51

Browse files
committed
fix: form info alignment issues
1 parent b052f3e commit 84faf51

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

src/Shared/Components/FormFieldWrapper/FormFieldInfo.tsx

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,26 @@ const FormInfoItem = ({ id, text, icon, textClass }: FormInfoItemProps) => (
1111
</div>
1212
)
1313

14-
const FormFieldInfo = ({ error, helperText, warningText, inputId }: FormFieldInfoProps) =>
15-
error || helperText || warningText ? (
16-
<div className="flex left column dc__gap-4">
17-
{error && (
18-
<FormInfoItem text={error} icon={<ICError />} textClass="cr-5" id={getFormErrorElementId(inputId)} />
19-
)}
20-
{helperText && (
21-
<FormInfoItem
22-
text={helperText}
23-
icon={<ICInfoFilledOverride className="info-icon-n7" />}
24-
textClass="cn-7"
25-
id={`${inputId}-helper-text`}
26-
/>
27-
)}
28-
{warningText && (
29-
<FormInfoItem
30-
text={warningText}
31-
icon={<ICWarning className="warning-icon-y7" />}
32-
textClass="cy-7"
33-
id={`${inputId}-warning-msg`}
34-
/>
35-
)}
36-
</div>
37-
) : null
14+
const FormFieldInfo = ({ error, helperText, warningText, inputId }: FormFieldInfoProps) => (
15+
<div className="flex left column dc__gap-4">
16+
{error && <FormInfoItem text={error} icon={<ICError />} textClass="cr-5" id={getFormErrorElementId(inputId)} />}
17+
{helperText && (
18+
<FormInfoItem
19+
text={helperText}
20+
icon={<ICInfoFilledOverride className="info-icon-n7" />}
21+
textClass="cn-7"
22+
id={`${inputId}-helper-text`}
23+
/>
24+
)}
25+
{warningText && (
26+
<FormInfoItem
27+
text={warningText}
28+
icon={<ICWarning className="warning-icon-y7" />}
29+
textClass="cy-7"
30+
id={`${inputId}-warning-msg`}
31+
/>
32+
)}
33+
</div>
34+
)
3835

3936
export default FormFieldInfo

src/Shared/Components/FormFieldWrapper/FormFieldWrapper.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ const FormFieldWrapper = ({
2626
)}
2727
<div className="w-100">{children}</div>
2828
</div>
29-
<div className="flex left dc__gap-6 w-100">
30-
{/* Added a hidden div for layout sync */}
31-
{isRowLayout && <div className={`${itemContainerClassName} dc__visibility-hidden`} />}
32-
<FormFieldInfo inputId={inputId} error={error} helperText={helperText} warningText={warningText} />
33-
</div>
29+
{(error || helperText || warningText) && (
30+
<div className="flex left dc__gap-6 w-100">
31+
{/* Added a hidden div for layout sync */}
32+
{isRowLayout && <div className={`${itemContainerClassName} dc__visibility-hidden`} />}
33+
<FormFieldInfo inputId={inputId} error={error} helperText={helperText} warningText={warningText} />
34+
</div>
35+
)}
3436
</div>
3537
)
3638
}

0 commit comments

Comments
 (0)