Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3186 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3186 Rev 3530
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react';
2
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form';
3
import { useSelector } from 'react-redux'
3
import { useSelector } from 'react-redux';
4
import { Box, Button } from '@mui/material'
4
import { Box, Button } from '@mui/material';
Línea 5... Línea 5...
5
 
5
 
6
import Input from '@components/UI/inputs/Input'
6
import Input from '@components/UI/inputs/Input';
Línea 7... Línea 7...
7
import Form from '@components/common/form'
7
import Form from '@components/common/form';
8
 
8
 
Línea 9... Línea 9...
9
export default function CommentForm({ onSubmit = () => {} }) {
9
export default function CommentForm({ onSubmit = () => {} }) {
10
  const labels = useSelector(({ intl }) => intl.labels)
10
  const labels = useSelector(({ intl }) => intl.labels);
11
 
11
 
12
  const {
12
  const {
13
    control,
13
    control,
14
    handleSubmit,
14
    handleSubmit,
15
    reset,
15
    reset,
16
    formState: { errors }
16
    formState: { errors }
17
  } = useForm({
17
  } = useForm({
18
    defaultValues: {
18
    defaultValues: {
Línea 19... Línea 19...
19
      comment: ''
19
      comment: ''
20
    }
20
    }
21
  })
21
  });
22
 
22
 
Línea 23... Línea 23...
23
  const submitHandler = handleSubmit(({ comment }) => {
23
  const submitHandler = handleSubmit(({ comment }) => {
24
    onSubmit(comment)
24
    onSubmit(comment);
25
    reset()
25
    reset();
26
  })
26
  });
Línea 41... Línea 41...
41
          error={errors.comment?.message}
41
          error={errors.comment?.message}
42
          rules={{ required: 'Este campo es requerido' }}
42
          rules={{ required: 'Este campo es requerido' }}
43
          variant='search'
43
          variant='search'
44
          autoComplete='off'
44
          autoComplete='off'
45
        />
45
        />
46
        <Button color='primary'>Publicar</Button>
46
        <Button color='primary' type='submit'>
-
 
47
          Publicar
-
 
48
        </Button>
47
      </Box>
49
      </Box>
48
    </Form>
50
    </Form>
49
  )
51
  );
50
}
52
}