fix(try-it-out): Better tooltips for min/max validations (#6266)

This commit is contained in:
Helen Kosova
2020-07-29 03:10:40 +03:00
committed by GitHub
parent bd9117da8e
commit 4cbae095fc
2 changed files with 23 additions and 30 deletions

View File

@@ -325,13 +325,13 @@ export const propChecker = (props, nextProps, objectList=[], ignoreList=[]) => {
export const validateMaximum = ( val, max ) => {
if (val > max) {
return "Value must be less than Maximum"
return `Value must be less than ${max}`
}
}
export const validateMinimum = ( val, min ) => {
if (val < min) {
return "Value must be greater than Minimum"
return `Value must be greater than ${min}`
}
}
@@ -380,13 +380,13 @@ export const validateGuid = (val) => {
export const validateMaxLength = (val, max) => {
if (val.length > max) {
return "Value must be less than MaxLength"
return `Value must be no longer than ${max} character${max !== 1 ? "s" : ""}`
}
}
export const validateMinLength = (val, min) => {
if (val.length < min) {
return "Value must be greater than MinLength"
return `Value must be at least ${min} character${min !== 1 ? "s" : ""}`
}
}