forked from M3-Academy/desafio-react-e-typescript
feat(home): realizando componentização do ButtonForm
This commit is contained in:
parent
596858810e
commit
dc41d8bd11
18
src/components/Atoms/ButtonForm/ButtonForm.tsx
Normal file
18
src/components/Atoms/ButtonForm/ButtonForm.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import { ButtonHTMLAttributes } from "react";
|
||||
|
||||
interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
className?: string;
|
||||
type: "button" | "submit" | "reset";
|
||||
disabled?: boolean;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export const ButtonForm = (props: IButtonProps) => {
|
||||
const { className, text, type, disabled } = props;
|
||||
|
||||
return (
|
||||
<button className={className} type={type} disabled={disabled}>
|
||||
{text}
|
||||
</button>
|
||||
);
|
||||
};
|
@ -5,6 +5,7 @@ import { useState } from "react";
|
||||
|
||||
import FormSchema from "../../../schema/FormSchema";
|
||||
import styles from "./FaleConosco.module.scss";
|
||||
import { ButtonForm } from "../../Atoms/ButtonForm/ButtonForm";
|
||||
|
||||
interface IFormikValues {
|
||||
name: string;
|
||||
@ -202,13 +203,13 @@ const FaleConosco = () => {
|
||||
<Field name="acceptTerms" type="checkbox" />
|
||||
</div>
|
||||
|
||||
<button
|
||||
<ButtonForm
|
||||
className={styles["form__button"]}
|
||||
disabled={!isValid}
|
||||
type="submit"
|
||||
>
|
||||
CADASTRE-SE
|
||||
</button>
|
||||
text={"CADASTRE-SE"}
|
||||
/>
|
||||
|
||||
{FormSuccess && (
|
||||
<span className={styles["form__wrapper__success"]}>
|
||||
*Formulário enviado com sucesso*
|
||||
|
@ -37,7 +37,11 @@ const FooterBottom = () => {
|
||||
</ul>
|
||||
<div className={styles["footer__bottom__payments__divider"]}></div>
|
||||
<ul className={styles["footer__bottom__payments__security"]}>
|
||||
<Icone src={vtex} alt="Vtex PCI - SECURITY" />
|
||||
<Icone
|
||||
src={vtex}
|
||||
alt="Vtex PCI - SECURITY"
|
||||
className={styles["vtex-security"]}
|
||||
/>
|
||||
</ul>
|
||||
</div>
|
||||
<div className={styles["footer__bottom__development"]}>
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Formik, Form, Field, ErrorMessage } from "formik";
|
||||
import { ButtonForm } from "../../../Atoms/ButtonForm/ButtonForm";
|
||||
import styles from "./FooterNewsletter.module.scss";
|
||||
|
||||
interface IFormikValue {
|
||||
@ -36,9 +37,11 @@ const FooterNewsletter = () => {
|
||||
className={styles["footer-newsletter__form__error"]}
|
||||
component="span"
|
||||
/>
|
||||
<button type="submit" className={styles["footer-newsletter__form__btn"]}>
|
||||
ENVIAR
|
||||
</button>
|
||||
<ButtonForm
|
||||
type="submit"
|
||||
className={styles["footer-newsletter__form__btn"]}
|
||||
text={"ENVIAR"}
|
||||
/>
|
||||
</div>
|
||||
</Form>
|
||||
</Formik>
|
||||
|
Loading…
Reference in New Issue
Block a user