From 6fe04e7981da7273f58ee1e85409c929ec7e7b16 Mon Sep 17 00:00:00 2001 From: Amanda Date: Mon, 16 Jan 2023 23:23:05 -0300 Subject: [PATCH] feat(fixo/footer): Adiciona menu fixo e responsividade do footer --- .../Main/Subject/Contato/RegistrationForm.tsx | 19 +-- src/components/footer/Footer.tsx | 2 + .../footer/footer-bottom/autores/autores.tsx | 9 +- .../footer/footer-bottom/footer-bottom.tsx | 7 +- .../footer/footer-bottom/pagamento/imgs.tsx | 2 +- .../footer-top/Fale-conosco/FaleConosco.tsx | 12 +- src/components/footer/footer.module.scss | 123 ++++++++++++++++-- .../footer/icon-fixed/assets/Seta.svg | 3 + .../assets/whatsapp.svg} | 0 .../footer/icon-fixed/icon-fixed.tsx | 21 +++ .../footer/icon-fixed/link/Link.tsx | 18 +++ .../footer/newsletter/Newsletter.tsx | 44 ++++++- .../footer/newsletter/input/Input.tsx | 19 --- .../footer/{footer-bottom => }/text/Text.tsx | 5 +- src/schema/FormSchema.ts | 29 +++-- src/schema/NewsletterSchema.ts | 7 + 16 files changed, 238 insertions(+), 82 deletions(-) create mode 100644 src/components/footer/icon-fixed/assets/Seta.svg rename src/components/footer/{footer-bottom/assets/whatsapp 1.svg => icon-fixed/assets/whatsapp.svg} (100%) create mode 100644 src/components/footer/icon-fixed/icon-fixed.tsx create mode 100644 src/components/footer/icon-fixed/link/Link.tsx delete mode 100644 src/components/footer/newsletter/input/Input.tsx rename src/components/footer/{footer-bottom => }/text/Text.tsx (64%) create mode 100644 src/schema/NewsletterSchema.ts diff --git a/src/components/Main/Subject/Contato/RegistrationForm.tsx b/src/components/Main/Subject/Contato/RegistrationForm.tsx index f024d39..dc9e4fc 100644 --- a/src/components/Main/Subject/Contato/RegistrationForm.tsx +++ b/src/components/Main/Subject/Contato/RegistrationForm.tsx @@ -2,7 +2,7 @@ import { useCallback, useState } from "react"; import styles from "./form.module.scss"; import stylesInput from "./input.module.scss"; import stylesCheckbox from "./checkbox.module.scss"; -import FormSchema from "../../../../schema/FormSchema"; +import { FormSchema } from "../../../../schema/FormSchema"; import { Formik, Form, Field, ErrorMessage } from "formik"; @@ -28,17 +28,6 @@ const initialValues = { const RegistrationForm = () => { const [isSubmit, setIsSubmit] = useState(false); - const handleFormSubmit = (values: FormikValues) => { - values.name = ""; - values.email = ""; - values.cpf = ""; - values.data = ""; - values.tel = ""; - values.instagram = ""; - values.acceptTerms = false; - setIsSubmit(!isSubmit); - }; - const handleTel = useCallback((e: React.FormEvent) => { let value = e.currentTarget.value; value = value.replace(/\D/g, ""); @@ -68,7 +57,11 @@ const RegistrationForm = () => { return (
{ + console.log(values); + setIsSubmit(!isSubmit); + resetForm({ values: initialValues }); + }} initialValues={initialValues} validationSchema={FormSchema} > diff --git a/src/components/footer/Footer.tsx b/src/components/footer/Footer.tsx index 4241179..9b96686 100644 --- a/src/components/footer/Footer.tsx +++ b/src/components/footer/Footer.tsx @@ -3,6 +3,7 @@ import FooterBottom from "./footer-bottom/footer-bottom"; import FooterTop from "./footer-top/footerTop"; import styles from "./footer.module.scss"; +import IconFixed from "./icon-fixed/icon-fixed"; import Newsletter from "./newsletter/Newsletter"; const Footer = () => { @@ -11,6 +12,7 @@ const Footer = () => { + ); }; diff --git a/src/components/footer/footer-bottom/autores/autores.tsx b/src/components/footer/footer-bottom/autores/autores.tsx index 6675c14..bcf6cc6 100644 --- a/src/components/footer/footer-bottom/autores/autores.tsx +++ b/src/components/footer/footer-bottom/autores/autores.tsx @@ -2,16 +2,19 @@ import React from "react"; import styles from "../../footer.module.scss"; import Img from "../img-footer/img"; -import Text from "../text/Text"; +import Text from "../../text/Text"; import Vtex from "../assets/Vtex.svg"; import M3 from "../assets/M3.svg"; const Autores = () => { return (
- + - +
); diff --git a/src/components/footer/footer-bottom/footer-bottom.tsx b/src/components/footer/footer-bottom/footer-bottom.tsx index 1ecd355..8462ce9 100644 --- a/src/components/footer/footer-bottom/footer-bottom.tsx +++ b/src/components/footer/footer-bottom/footer-bottom.tsx @@ -2,15 +2,16 @@ import React from "react"; import styles from "../footer.module.scss"; import Autores from "./autores/autores"; -import Text from "./text/Text"; +import Text from "../text/Text"; import Imgs from "./pagamento/imgs"; const FooterBottom = () => { return ( -
+
@@ -18,7 +19,7 @@ const FooterBottom = () => {
-
+ ); }; diff --git a/src/components/footer/footer-bottom/pagamento/imgs.tsx b/src/components/footer/footer-bottom/pagamento/imgs.tsx index bb366e4..f00a9e3 100644 --- a/src/components/footer/footer-bottom/pagamento/imgs.tsx +++ b/src/components/footer/footer-bottom/pagamento/imgs.tsx @@ -25,7 +25,7 @@ const imgs = () => { - +
); diff --git a/src/components/footer/footer-top/Fale-conosco/FaleConosco.tsx b/src/components/footer/footer-top/Fale-conosco/FaleConosco.tsx index 5a46b83..0fc3156 100644 --- a/src/components/footer/footer-top/Fale-conosco/FaleConosco.tsx +++ b/src/components/footer/footer-top/Fale-conosco/FaleConosco.tsx @@ -2,6 +2,7 @@ import React, { useState } from "react"; import Link from "../../../link/Link"; import styles from "../../footer.module.scss"; +import Text from "../../text/Text"; import ButtonFooterMobile from "../button/button"; import Title from "../title/Title"; @@ -22,17 +23,12 @@ const FaleConosco = () => { />
- - + + + diff --git a/src/components/footer/footer-bottom/assets/whatsapp 1.svg b/src/components/footer/icon-fixed/assets/whatsapp.svg similarity index 100% rename from src/components/footer/footer-bottom/assets/whatsapp 1.svg rename to src/components/footer/icon-fixed/assets/whatsapp.svg diff --git a/src/components/footer/icon-fixed/icon-fixed.tsx b/src/components/footer/icon-fixed/icon-fixed.tsx new file mode 100644 index 0000000..a911daa --- /dev/null +++ b/src/components/footer/icon-fixed/icon-fixed.tsx @@ -0,0 +1,21 @@ +import React from "react"; +import LinkTop from "./link/Link"; +import Whatsapp from "./assets/whatsapp.svg"; +import Seta from "./assets/Seta.svg"; + +import styles from "../../footer/footer.module.scss"; + +const IconFixed = () => { + return ( +
+ + +
+ ); +}; + +export default IconFixed; diff --git a/src/components/footer/icon-fixed/link/Link.tsx b/src/components/footer/icon-fixed/link/Link.tsx new file mode 100644 index 0000000..bed2c96 --- /dev/null +++ b/src/components/footer/icon-fixed/link/Link.tsx @@ -0,0 +1,18 @@ +import React from "react"; + +interface LinkProps { + img: string; + className: string; + href?: string; + onClick?: React.MouseEventHandler; +} + +const LinkTop = (props: LinkProps) => { + return ( + + + + ); +}; + +export default LinkTop; diff --git a/src/components/footer/newsletter/Newsletter.tsx b/src/components/footer/newsletter/Newsletter.tsx index 03babf6..282578a 100644 --- a/src/components/footer/newsletter/Newsletter.tsx +++ b/src/components/footer/newsletter/Newsletter.tsx @@ -1,20 +1,50 @@ -import React from "react"; +import React, { useState } from "react"; import Button from "../../button/Button"; - +import { Formik, Form, Field, ErrorMessage } from "formik"; import styles from "../footer.module.scss"; -import Input from "./input/Input"; +import { NewsletterSchema } from "../../../schema/NewsletterSchema"; + +interface FormikValues { + email: string; +} + +const initialValues = { + email: "", +}; const Newsletter = () => { + const [isSubmit, setIsSubmit] = useState(false); return (

ASSINE NOSSA NEWSLETTER

-
- -
); diff --git a/src/components/footer/newsletter/input/Input.tsx b/src/components/footer/newsletter/input/Input.tsx deleted file mode 100644 index eeacbab..0000000 --- a/src/components/footer/newsletter/input/Input.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from "react"; - -import styles from "../../footer.module.scss"; - -interface InputProps { - placeholder: string; -} - -const Input = (props: InputProps) => { - return ( - - ); -}; - -export default Input; diff --git a/src/components/footer/footer-bottom/text/Text.tsx b/src/components/footer/text/Text.tsx similarity index 64% rename from src/components/footer/footer-bottom/text/Text.tsx rename to src/components/footer/text/Text.tsx index ebd473e..606914d 100644 --- a/src/components/footer/footer-bottom/text/Text.tsx +++ b/src/components/footer/text/Text.tsx @@ -3,12 +3,11 @@ import styles from "../../footer.module.scss"; interface TextProps { text: string; + className: string; } const Text = (props: TextProps) => { - return ( - {props.text} - ); + return

{props.text}

; }; export default Text; diff --git a/src/schema/FormSchema.ts b/src/schema/FormSchema.ts index a40ed58..9e0781b 100644 --- a/src/schema/FormSchema.ts +++ b/src/schema/FormSchema.ts @@ -1,15 +1,18 @@ import * as Yup from "yup"; -export default Yup.object().shape({ - name: Yup.string() - .min(3, "mínimo 3 caracteres") - .required("*Campo Obrigatório"), - email: Yup.string().required("*Campo Obrigatório").email("Email inválido"), - cpf: Yup.string().length(14).required("*Campo Obrigatório"), - data: Yup.date() - .required("*Campo Obrigatório") - .max(new Date(), "Não é possível incluir uma data futura"), - tel: Yup.string().length(15).required("*Campo Obrigatório"), - instagram: Yup.string(), - acceptTerms: Yup.bool().oneOf([true], "*"), -}); +const FormSchema = () => + Yup.object().shape({ + name: Yup.string() + .min(3, "mínimo 3 caracteres") + .required("*Campo Obrigatório"), + email: Yup.string().required("*Campo Obrigatório").email("Email inválido"), + cpf: Yup.string().length(14).required("*Campo Obrigatório"), + data: Yup.date() + .required("*Campo Obrigatório") + .max(new Date(), "Não é possível incluir uma data futura"), + tel: Yup.string().length(15).required("*Campo Obrigatório"), + instagram: Yup.string(), + acceptTerms: Yup.bool().oneOf([true], "*"), + }); + +export { FormSchema }; diff --git a/src/schema/NewsletterSchema.ts b/src/schema/NewsletterSchema.ts new file mode 100644 index 0000000..88ac26e --- /dev/null +++ b/src/schema/NewsletterSchema.ts @@ -0,0 +1,7 @@ +import * as Yup from "yup"; + +const NewsletterSchema = () => + Yup.object().shape({ + email: Yup.string().required("*Campo Obrigatório").email("Email inválido"), + }); +export { NewsletterSchema };