|
| 1 | +import { useForm } from 'react-hook-form'; |
| 2 | +import { FormInputText } from '../../../components/CustomFormInputs'; |
| 3 | +import { Box, Button, Grid, Typography, useTheme } from '@mui/material'; |
| 4 | +import FlexBetween from '../../../components/FlexBetween'; |
| 5 | + |
| 6 | +const ContactForm = () => { |
| 7 | + const theme = useTheme(); |
| 8 | + const { handleSubmit, control, reset } = useForm({ |
| 9 | + defaultValues: { |
| 10 | + name: '', |
| 11 | + email: '', |
| 12 | + subject: '', |
| 13 | + message: '', |
| 14 | + }, |
| 15 | + }); |
| 16 | + const onSubmit = (data: any) => console.log(data); |
| 17 | + return ( |
| 18 | + <> |
| 19 | + <Grid container> |
| 20 | + <Grid item md={6} lg={4}> |
| 21 | + <Box display='flex' flexWrap='wrap' justifyContent='space-around' gap='2.8rem'> |
| 22 | + <FlexBetween> |
| 23 | + <Box component='img' alt='location' src='/assets/location.svg' /> |
| 24 | + <Box |
| 25 | + justifyContent='center' |
| 26 | + alignItems='center' |
| 27 | + display='flex' |
| 28 | + flexDirection={'column'} |
| 29 | + width='212px' |
| 30 | + > |
| 31 | + <Typography variant='h6'>Address</Typography> |
| 32 | + <Typography variant='body2' textAlign={'center'}> |
| 33 | + 236 5th SE Avenue, New York NY10000, United States |
| 34 | + </Typography> |
| 35 | + </Box> |
| 36 | + </FlexBetween> |
| 37 | + <FlexBetween> |
| 38 | + <Box component='img' alt='location' src='/assets/clock.svg' /> |
| 39 | + <Box |
| 40 | + justifyContent='center' |
| 41 | + alignItems='center' |
| 42 | + display='flex' |
| 43 | + flexDirection={'column'} |
| 44 | + width='212px' |
| 45 | + > |
| 46 | + <Typography variant='h6'>Working Time</Typography> |
| 47 | + <Typography variant='body2' textAlign={'center'}> |
| 48 | + Monday-Friday: 9:00 - 22:00 Saturday-Sunday: 9:00 - 21:00 |
| 49 | + </Typography> |
| 50 | + </Box> |
| 51 | + </FlexBetween> |
| 52 | + <FlexBetween> |
| 53 | + <Box component='img' alt='location' src='/assets/location.svg' /> |
| 54 | + <Box |
| 55 | + justifyContent='center' |
| 56 | + alignItems='center' |
| 57 | + display='flex' |
| 58 | + flexDirection={'column'} |
| 59 | + width='212px' |
| 60 | + > |
| 61 | + <Typography variant='h6'>Address</Typography> |
| 62 | + <Typography variant='body2' textAlign={'center'}> |
| 63 | + 236 5th SE Avenue, New York NY10000, United States |
| 64 | + </Typography> |
| 65 | + </Box> |
| 66 | + </FlexBetween> |
| 67 | + </Box> |
| 68 | + </Grid> |
| 69 | + |
| 70 | + <Grid item xs={12} md={6} lg={8}> |
| 71 | + {' '} |
| 72 | + <form |
| 73 | + onSubmit={handleSubmit(onSubmit)} |
| 74 | + style={{ |
| 75 | + display: 'flex', |
| 76 | + flexDirection: 'column', |
| 77 | + justifyContent: 'center', |
| 78 | + alignItems: 'center', |
| 79 | + gap: '3.5rem', |
| 80 | + }} |
| 81 | + > |
| 82 | + <FormInputText name='name' control={control} label='Your name' /> |
| 83 | + <FormInputText name='email' control={control} label='Email Address' /> |
| 84 | + <FormInputText name='subject' control={control} label='Subject' /> |
| 85 | + <FormInputText name='message' control={control} label='Message' /> |
| 86 | + </form> |
| 87 | + <Box my='1rem'> |
| 88 | + <Button |
| 89 | + type='submit' |
| 90 | + sx={{ |
| 91 | + background: theme.palette.secondary.main, |
| 92 | + padding: '0.5rem 2.5rem', |
| 93 | + '&:hover': { |
| 94 | + background: theme.palette.secondary[400], |
| 95 | + }, |
| 96 | + }} |
| 97 | + > |
| 98 | + Submit |
| 99 | + </Button> |
| 100 | + </Box> |
| 101 | + </Grid> |
| 102 | + </Grid> |
| 103 | + </> |
| 104 | + ); |
| 105 | +}; |
| 106 | + |
| 107 | +export default ContactForm; |
0 commit comments