refactor: organizando arquivos do yup em uma pasta

This commit is contained in:
Ana Carolina Duarte Cavalcante 2023-01-14 10:52:16 -03:00
parent fdb349cb86
commit be31f120e6
4 changed files with 7 additions and 7 deletions

View File

@ -1,13 +1,13 @@
import styles from "./styles/Footer.module.scss";
import { Formik, Field, Form } from "formik";
import schema from "./schema";
import schema from "../../schema/NewsletterSchema";
interface NewsletterArea {
email: string;
newsletteremail: string;
}
const initialValues = {
email: "",
newsletteremail: "",
};
const Newsletter = () => {
@ -23,7 +23,7 @@ const Newsletter = () => {
assine nossa newsletter
</h3>
<div className={styles["Newsletter__Content__Block__Register"]}>
<Field type="text" placeholder="E-mail" name="email" />
<Field type="text" placeholder="E-mail" name="newsletteremail" />
<button type="submit" disabled={!isValid}>Enviar</button>
</div>
</div>

View File

@ -1,5 +1,5 @@
import { Formik, Field, Form } from "formik";
import schema from "../schema";
import schema from "../../../schema/FormSchema";
import styles from "../styles/Main.module.scss";
import { FormField } from "../Contato/FormContentField/FormContentField";
import { useState } from "react";

View File

@ -1,8 +1,8 @@
import * as Yup from 'yup';
const email =
const newsletteremail =
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
export default Yup.object().shape({
email: Yup.string().email().matches(email).required(),
newsletteremail: Yup.string().email().matches(newsletteremail).required(),
});