Numeric range tweaks (#1445)

* tweaks to help with layout for numeric ranges

* use negative infinity for min

* remove some debug code

---------

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-04-24 16:04:55 +00:00 committed by GitHub
parent ae502e50d7
commit f773823008
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View File

@ -262,9 +262,7 @@ export default function CustomForm({
(formDataToCheck[propertyKey].min === undefined ||
formDataToCheck[propertyKey].max === undefined)
) {
errors[propertyKey].addError(
`must have valid Minimum and Maximum on ${propertyKey}`
);
errors[propertyKey].addError('must have valid Minimum and Maximum');
}
if (
formDataToCheck[propertyKey].min <

View File

@ -117,17 +117,19 @@ export default function NumericRangeField({
};
let minHelperText = '';
if (minNumber !== undefined) {
minHelperText = `Min: ${formatNumberString(minNumber?.toString() || '')}`;
}
let maxHelperText = '';
if (maxNumber !== undefined) {
maxHelperText = `Max: ${formatNumberString(maxNumber?.toString() || '')}`;
if (minNumber !== undefined || maxNumber !== undefined) {
minHelperText = `Min: ${
formatNumberString(minNumber?.toString() || '') || '-∞'
}`;
maxHelperText = `Max: ${
formatNumberString(maxNumber?.toString() || '') || '∞'
}`;
}
return (
<div className="numeric--range-field-wrapper">
<div className="numeric--range-field-label">
<div>
<h5>
{required
? commonAttributes.labelWithRequiredIndicator