-
©Copyrigth 2023. Todos los derechos reservados - Desarrollado por: Work
Team
diff --git a/src/components/footer/Links.tsx b/src/components/footer/Links.tsx
index 4e6a0bf..66897d0 100644
--- a/src/components/footer/Links.tsx
+++ b/src/components/footer/Links.tsx
@@ -6,7 +6,6 @@ interface LinksProps {}
const LinksRoutes = [
{ name: 'Nosotros', route: '/aboutUs' },
{ name: 'Como comprar', route: '/como-comprar' },
- { name: 'Contacto', route: '/contact' },
{ name: 'Blog', route: 'https://actualizatucarro.blogspot.com/' },
];
@@ -18,9 +17,7 @@ const Links: FC = () => {
{link.name}
- {index !== LinksRoutes.length - 1 && (
-
- )}
+
>
))}
>
diff --git a/src/components/form/Form.tsx b/src/components/form/Form.tsx
new file mode 100644
index 0000000..1884a45
--- /dev/null
+++ b/src/components/form/Form.tsx
@@ -0,0 +1,143 @@
+'use client';
+import React, { FC } from 'react';
+import { useForm, SubmitHandler } from 'react-hook-form';
+import { InputField } from '../inputs/InputField';
+import { MainButton } from '../button/button';
+import Icon from '~/assets/icons/icon';
+import Swal from 'sweetalert2';
+
+interface FormProp {
+ updateState: (flagState: boolean) => void; // Corregido el tipo de isOpenContact
+}
+
+interface FormProps {
+ name: string;
+ phone: string;
+ message: string;
+}
+
+const Form: FC = ({ updateState }) => {
+ const {
+ register,
+ handleSubmit,
+ reset,
+ formState: { errors },
+ } = useForm();
+
+ const handleFormSubmit: SubmitHandler = (data, event) => {
+ event?.preventDefault();
+ if (!errors.name || !errors.phone || !errors.message) {
+ updateState(false);
+ alertSuccess();
+ console.log(data);
+ }
+ };
+
+ const alertSuccess = () => {
+ Swal.fire({
+ toast: true,
+ position: 'top-end',
+ title: 'Enviado!',
+ text: 'El mensaje a sido enviado correctamente',
+ icon: 'success',
+ showConfirmButton: false,
+ timer: 2000,
+ });
+ };
+
+ return (
+
+ );
+};
+
+export default Form;
diff --git a/src/components/navBar/MenuMobile.tsx b/src/components/navBar/MenuMobile.tsx
index a6e5d74..0c9ef06 100644
--- a/src/components/navBar/MenuMobile.tsx
+++ b/src/components/navBar/MenuMobile.tsx
@@ -1,15 +1,16 @@
import Link from 'next/link';
import React, { FC } from 'react';
-interface MenuMobileProps {}
+interface MenuMobileProps {
+ updateState: (isOpenContact: boolean) => void;
+}
-const MenuMobile: FC = ({}) => {
+const MenuMobile: FC = ({ updateState }) => {
const navItems = [
{ label: 'Productos', url: '/products' },
{ label: 'Como comprar', url: '/how-to-buy' },
{ label: 'Blog', url: '/blog' },
{ label: 'Nosotros', url: '/about-us' },
- { label: 'Contacto', url: '/contact' },
];
return (
@@ -25,6 +26,12 @@ const MenuMobile: FC = ({}) => {
>
))}
+
);
};
diff --git a/src/components/navBar/navBar.tsx b/src/components/navBar/navBar.tsx
index be939ee..4b4a8ab 100644
--- a/src/components/navBar/navBar.tsx
+++ b/src/components/navBar/navBar.tsx
@@ -8,14 +8,17 @@ import MenuMobile from './MenuMobile';
import { InputField } from '../inputs/InputField';
import { ThemeModeButton } from '../ThemeMode';
import { MainButton } from '../button/button';
+import { useFlagState } from '~/hooks/useFlagState';
+import Form from '../form/Form';
interface NavBarProps {}
const NavBar: FC