diff --git a/src/components/Footer/Newsletter/Newsletter.tsx b/src/components/Footer/Newsletter/Newsletter.tsx index a344de4..4d759e9 100644 --- a/src/components/Footer/Newsletter/Newsletter.tsx +++ b/src/components/Footer/Newsletter/Newsletter.tsx @@ -1,19 +1,51 @@ +import { Formik, FormikHelpers } from "formik"; import React from "react"; +import { Form } from "react-router-dom"; +import NewsletterSchema from "../../../schema/NewsletterSchema"; import styles from "./Newsletter.module.scss"; +interface FormValues { + email: string; +} + +const initialValues = { + email: "", +}; + +const newsletterList: Array = []; + const Newsletter = () => { + const handleSubmit = ( + values: FormValues, + { resetForm }: FormikHelpers + ) => { + newsletterList.push(values); + console.log(newsletterList); + resetForm(); + }; + return ( -
-

- {/* ASSINE NOSSA NEWSLETTER */} - assine nossa newsletter -

-
- - -
-
+ <> + + {({ resetForm }) => ( +
+

+ {/* ASSINE NOSSA NEWSLETTER */} + assine nossa newsletter +

+
+ + +
+
+ )} +
+ ); }; diff --git a/src/components/Header/Searchbox/Searchbox.tsx b/src/components/Header/Searchbox/Searchbox.tsx index cb6e148..18fef69 100644 --- a/src/components/Header/Searchbox/Searchbox.tsx +++ b/src/components/Header/Searchbox/Searchbox.tsx @@ -1,10 +1,10 @@ -import { Field, Form, Formik } from "formik"; -import FormSchema from "../../../schema/FormSchema"; +import { Field, Form, Formik, FormikHelpers } from "formik"; +import SearchboxSchema from "../../../schema/SearchboxSchema"; import searchIcon from "../assets/search-icon.svg"; import styles from "./Searchbox.module.scss"; -interface IFormikValues { +interface FormValues { searchInput: string; } @@ -13,8 +13,9 @@ const initialValues = { }; const Searchbox = () => { - const handleSubmit = (values: IFormikValues) => { + const handleSubmit = (values: FormValues, { resetForm }: FormikHelpers) => { console.log(values); + resetForm(); }; return ( @@ -22,15 +23,14 @@ const Searchbox = () => { - {({ errors, touched, resetForm }) => ( + {({ resetForm }) => (