You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
642 B
29 lines
642 B
// common validators across base components
|
|
|
|
import { chamiloIconToClass } from "./ChamiloIcons"
|
|
|
|
export const iconValidator = (value) => {
|
|
if (typeof value !== "string") {
|
|
return false
|
|
}
|
|
|
|
return Object.keys(chamiloIconToClass).includes(value)
|
|
}
|
|
|
|
export const sizeValidator = (value) => {
|
|
if (typeof value !== "string") {
|
|
return false
|
|
}
|
|
|
|
return ["normal", "small"].includes(value)
|
|
}
|
|
|
|
export const buttonTypeValidator = (value) => {
|
|
if (typeof value !== "string") {
|
|
return false
|
|
}
|
|
|
|
return ["primary", "primary-alternative", "secondary", "black", "success", "info", "warning", "danger"].includes(
|
|
value,
|
|
)
|
|
}
|
|
|