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