|
|
|
@ -1,18 +1,18 @@
|
|
|
|
|
import { useState, forwardRef } from 'react'
|
|
|
|
|
import { useFormContext } from 'react-hook-form'
|
|
|
|
|
import TextareaAutosize from 'react-textarea-autosize'
|
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Button,
|
|
|
|
|
Flex,
|
|
|
|
|
Stack,
|
|
|
|
|
Box,
|
|
|
|
|
Text,
|
|
|
|
|
Input,
|
|
|
|
|
FormControl,
|
|
|
|
|
FormErrorMessage,
|
|
|
|
|
Input,
|
|
|
|
|
InputProps,
|
|
|
|
|
Stack,
|
|
|
|
|
Text,
|
|
|
|
|
Textarea,
|
|
|
|
|
} from '@chakra-ui/react'
|
|
|
|
|
import { forwardRef, useState } from 'react'
|
|
|
|
|
import { useFormContext } from 'react-hook-form'
|
|
|
|
|
import TextareaAutosize from 'react-textarea-autosize'
|
|
|
|
|
|
|
|
|
|
const CustomInput = forwardRef<HTMLInputElement, InputProps>(
|
|
|
|
|
({ name, ...props }, ref) => {
|
|
|
|
@ -35,11 +35,11 @@ const CustomInput = forwardRef<HTMLInputElement, InputProps>(
|
|
|
|
|
|
|
|
|
|
CustomInput.displayName = 'CustomInput'
|
|
|
|
|
|
|
|
|
|
type FormFields = {
|
|
|
|
|
name: string
|
|
|
|
|
email: string
|
|
|
|
|
message: string
|
|
|
|
|
}
|
|
|
|
|
// type FormFields = {
|
|
|
|
|
// name: string
|
|
|
|
|
// email: string
|
|
|
|
|
// message: string
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
const sendMessage = async () => {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
@ -99,7 +99,7 @@ const ContactForm: React.FC = () => {
|
|
|
|
|
name="name"
|
|
|
|
|
placeholder="Nombre"
|
|
|
|
|
aria-label="Nombre"
|
|
|
|
|
disabled={isSubmitSuccessful}
|
|
|
|
|
isDisabled={isSubmitSuccessful}
|
|
|
|
|
ref={register({ required: true })}
|
|
|
|
|
/>
|
|
|
|
|
<FormErrorMessage>Este campo es obligatorio</FormErrorMessage>
|
|
|
|
@ -110,7 +110,7 @@ const ContactForm: React.FC = () => {
|
|
|
|
|
name="email"
|
|
|
|
|
placeholder="e-mail"
|
|
|
|
|
aria-label="e-mail"
|
|
|
|
|
disabled={isSubmitSuccessful}
|
|
|
|
|
isDisabled={isSubmitSuccessful}
|
|
|
|
|
ref={register({
|
|
|
|
|
required: true,
|
|
|
|
|
pattern: /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,
|
|
|
|
@ -141,7 +141,7 @@ const ContactForm: React.FC = () => {
|
|
|
|
|
borderColor="gray"
|
|
|
|
|
focusBorderColor="primary"
|
|
|
|
|
overflow="hidden"
|
|
|
|
|
disabled={isSubmitSuccessful}
|
|
|
|
|
isDisabled={isSubmitSuccessful}
|
|
|
|
|
ref={register({ required: true })}
|
|
|
|
|
_disabled={{ color: 'gray' }}
|
|
|
|
|
/>
|
|
|
|
|