From c039c78aa21483c4c8cc87699542b6d47d30af87 Mon Sep 17 00:00:00 2001 From: Saulo Klein Nery Date: Thu, 19 Jan 2023 15:49:02 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20Conserta=20os=20formul=C3=A1rios=20do=20?= =?UTF-8?q?searchBar=20e=20Newsletter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SearchBar.tsx | 10 +++++----- src/schema/NewsletterSchema.ts | 5 +++++ src/schema/SearchBarFormSchema.ts | 1 - 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 src/schema/NewsletterSchema.ts diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index 2c09ebb..2281db5 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -1,6 +1,7 @@ import styles from "../styles/main.module.scss"; import { Formik, Form, Field, FormikHelpers, ErrorMessage } from "formik"; import SearchBarFormSchema from "../schema/SearchBarFormSchema"; +import NewsletterSchema from "../schema/NewsletterSchema"; interface SearchBarProps { search: string; @@ -24,17 +25,16 @@ const SearchBar = ({ }: SearchFormProps) => { if (!buttonText) buttonText = ""; + const schema = type === "search" ? SearchBarFormSchema : NewsletterSchema; + const handleFormSubmit = (values: SearchBarProps, actions: FormikHelpers) => { + console.log("submit"); console.log(values, actions); actions.resetForm(); }; return ( - +