feat(footer): Cria Newsletter desktop e mobile

This commit is contained in:
Sabrina Miranda 2023-01-09 01:18:45 -03:00
parent 6b3d005f22
commit 1d1cce8384
4 changed files with 263 additions and 1 deletions

View File

@ -0,0 +1,199 @@
@use '../../variables';
.newsletter {
&__container {
display: flex;
justify-content: center;
align-items: center;
border-top: 1px solid variables.$black;
border-bottom: 1px solid variables.$black;
}
&__form {
display: flex;
flex-direction: column;
gap: 8px;
margin: 16px 0;
position: relative;
@media (min-width: 3600px) {
margin: 18px 0;
}
@media (max-width: 1024px) {
width: 100%;
padding: 0 16px;
gap: 16px;
}
&__title {
font-weight: 500;
font-size: 18px;
line-height: 21px;
letter-spacing: 0.05em;
font-variant: small-caps;
color: variables.$black-300;
text-align: left;
@media (min-width: 3600px) {
font-size: 40px;
line-height: 48px;
}
@media ((min-width: 2500px) and (max-width: 3599px)) {
font-size: 36px;
line-height: 42px;
}
@media (max-width: 1024px) {
font-size: 14px;
line-height: 16px;
}
}
&__items {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: center;
gap: 8px;
@media (max-width: 1024px) {
flex-direction: column;
align-items: stretch;
gap: 16px;
}
&__email {
input {
background: variables.$white;
border: 1px solid variables.$gray-600;
border-radius: 4px;
width: 100%;
min-width: 340px;
height: 42px;
font-size: 14px;
line-height: 16px;
color: variables.$gray-400;
padding: 13px 16px;
&::placeholder {
font-size: 14px;
line-height: 16px;
color: variables.$gray-400;
}
@media (min-width: 3600px) {
font-size: 32px;
line-height: 36px;
min-width: 720px;
height: 64px;
&::placeholder {
font-size: 32px;
line-height: 36px;
}
}
@media ((min-width: 2500px) and (max-width: 3599px)) {
font-size: 28px;
line-height: 33px;
min-width: 668px;
height: 59px;
&::placeholder {
font-size: 28px;
line-height: 33px;
}
}
@media (max-width: 1024px) {
min-width: 100%;
padding: 17px 16px;
}
}
}
&__btn {
width: 126px;
height: 42px;
background: variables.$black;
box-shadow: 0px 4px 4px variables.$shadow;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 12px;
line-height: 14px;
letter-spacing: 0.05em;
color: variables.$white;
padding: 20px 14px;
text-transform: uppercase;
&:hover {
background: rgba($color: #000000, $alpha: .85);
border-color: transparent;
}
&:active {
background: variables.$black;
}
@media (min-width: 3600px) {
width: 280px;
height: 64px;
font-size: 28px;
line-height: 32px;
}
@media ((min-width: 2500px) and (max-width: 3599px)) {
width: 246px;
height: 59px;
font-size: 24px;
line-height: 28px;
}
@media (max-width: 1024px) {
width: 100%;
font-size: 14px;
line-height: 16px;
}
}
}
}
}
span{
font-size: 12px;
line-height: 14px;
color: variables.$red;
position: absolute;
right: 0;
top: 14px;
@media (min-width: 3600px) {
font-size: 26px;
line-height: 30px;
top: 20px;
}
@media ((min-width: 2500px) and (max-width: 3599px)) {
font-size: 24px;
line-height: 28px;
top: 20px;
}
@media (min-width: 350px) and (max-width: 1024px) {
right: 16px;
}
@media (max-width: 349px) {
font-size: 11px;
top: 18px;
right: 16px;
}
}

View File

@ -0,0 +1,55 @@
import React from 'react';
import { Formik, Form, Field, ErrorMessage} from "formik";
import styles from "./Newsletter.module.scss";
import NewsletterSchema from './Schema/NewsletterSchema';
interface NewsletterValue {
email: string;
}
const initialValue = {
email: "",
}
const Newsletter = () => {
const handleFormikSubmit = (values: NewsletterValue) => {
//console.log(values);
};
return (
<div className={styles["newsletter__container"]}>
<Formik
onSubmit={(values, { resetForm }) => {
handleFormikSubmit(values);
resetForm(); }}
initialValues={initialValue}
validationSchema={NewsletterSchema} >
{({errors, touched}) => (
<Form className={styles["newsletter__form"]}>
<h2 className={styles["newsletter__form__title"]}>ASSINE NOSSA NEWSLETTER</h2>
<div className={styles["newsletter__form__items"]}>
<div className={styles["newsletter__form__items__email"]}>
<Field id="email" name="email" placeholder='E-mail' className={errors.email && touched.email && "invalid"}
/>
<ErrorMessage component="span" name="email" className={styles["form-invalid-feedback"]}/>
</div>
<button className={styles["newsletter__form__items__btn"]} type="submit">
Enviar
</button>
</div>
</Form>
)}
</Formik>
</div>
);
};
export {Newsletter};

View File

@ -0,0 +1,5 @@
import * as Yup from "yup";
export default Yup.object().shape({
email: Yup.string().required("*Campo obrigatório").email("*E-mail Inválido"),
});

View File

@ -4,6 +4,7 @@ import styles from "./Home.module.scss";
import { HeaderTop } from '../components/HeaderTop/HeaderTop';
import { HeaderBottom } from '../components/HeaderBottom/HeaderBottom';
import { Newsletter } from '../components/Newsletter/Newsletter';
const Home = () => {
@ -16,7 +17,9 @@ const Home = () => {
<main></main>
<footer></footer>
<footer>
<Newsletter />
</footer>
</>
);
}