Zdockerovani, sjednoceni marginu, drobnejsi upravy

This commit is contained in:
Michal Kváček
2023-08-15 10:30:30 +02:00
parent b6ae794489
commit 8bc477a611
18 changed files with 280 additions and 159 deletions
+20 -1
View File
@@ -1 +1,20 @@
export const isRequired = (v) => !!v || "Required"
export const isRequired = (val) => !!val || "Toto pole je povinné";
export const isValidEmail = (email) => {
const patternEmail = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,10})+$/;
return !!patternEmail.test(email) || "Tento e-mail není platný";
};
export const minLength = (length) => (val) => val.length >= length || `Zadej alespoň ${length} znaky`
export const maxLength = (length) => (val) => val.length < length || `Zadej maximálně ${length} znaků`
export const isEmptyArray = () => (val) => {
return (val && val.length !== 0) || "Select item, please";
};
export const isNumber = () => (val) => {
return !isNaN(val) || "Only numbers are allowed";
};
export const hasNoWhitespace = () => (val) => {
return /^\S*$/.test(val) || "Don't use whitespaces";
};