Skip to content

Commit

Permalink
fix: footer input not required
Browse files Browse the repository at this point in the history
  • Loading branch information
stardustmeg committed Jun 3, 2024
1 parent 4f6f691 commit d75d40e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/shared/constants/forms/validationParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ export const EMAIL_VALIDATE = {
},
} as const;

export const FOOTER_EMAIL_VALIDATE = {
notWhitespace: {
messages: { en: 'Email must not contain white spaces', ru: 'Адрес электронной почты не должен содержать пробелы' },
pattern: /^\S+$/,
},
required: false,
validMail: {
messages: {
en: 'Enter correct email ([email protected])',
ru: 'Введите правильный адрес электронной почты ([email protected])',
},
pattern:
/^(?!.*[_.-]{2})(?!^[_.-])(?!.*[_\\-]$)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,6}$/,
},
} as const;

export const PASSWORD_VALIDATE = {
minLength: 8,
notWhitespace: {
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/Footer/view/FooterView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class FooterView {
cssClasses: [styles.subForm],
tag: 'form',
});
const email = new InputFieldModel(FORM_FIELDS.EMAIL_NOT_LABEL_TEXT, FORM_VALIDATION.EMAIL_VALIDATE);
const email = new InputFieldModel(FORM_FIELDS.EMAIL_NOT_LABEL_TEXT, FORM_VALIDATION.FOOTER_EMAIL_VALIDATE);
const inputFieldElement = email.getView().getHTML();
const inputHTML = email.getView().getInput().getHTML();
if (inputFieldElement instanceof HTMLLabelElement) {
Expand Down

0 comments on commit d75d40e

Please sign in to comment.