chore: do not render form header when label or description is not present (#4035)

This commit is contained in:
Ngô Quốc Đạt 2024-09-28 23:07:46 +07:00 committed by GitHub
parent 6444ccd6a5
commit 40a84fc3d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,10 +14,12 @@ export default class Form<CustomAttrs extends IFormAttrs = IFormAttrs> extends C
return (
<div className={classList('Form', className)} {...attrs}>
<div className="Form-header">
{label && <label>{label}</label>}
{description && <p className="helpText">{description}</p>}
</div>
{(label || description) && (
<div className="Form-header">
{label && <label>{label}</label>}
{description && <p className="helpText">{description}</p>}
</div>
)}
<div className="Form-body">{vnode.children}</div>
</div>
);