Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2843 Rev 3186
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'
Línea 4... Línea 5...
4
 
5
 
-
 
6
import Input from '@components/UI/inputs/Input'
Línea 5... Línea 7...
5
import Input from '@components/UI/inputs/Input'
7
import Form from '@components/common/form'
6
 
8
 
Línea 7... Línea 9...
7
export default function CommentForm({ onSubmit = () => null }) {
9
export default function CommentForm({ onSubmit = () => {} }) {
8
  const labels = useSelector(({ intl }) => intl.labels)
10
  const labels = useSelector(({ intl }) => intl.labels)
9
 
11
 
Línea 22... Línea 24...
22
    onSubmit(comment)
24
    onSubmit(comment)
23
    reset()
25
    reset()
24
  })
26
  })
Línea 25... Línea 27...
25
 
27
 
-
 
28
  return (
-
 
29
    <Form onSubmit={submitHandler}>
-
 
30
      <Box
-
 
31
        sx={{
-
 
32
          display: 'flex',
-
 
33
          gap: ({ spacing }) => spacing(0.5),
-
 
34
          alignItems: 'center'
-
 
35
        }}
26
  return (
36
      >
27
    <Input
37
        <Input
28
      name='comment'
38
          name='comment'
29
      placeholder={labels.write_a_comment}
39
          placeholder={labels.write_a_comment}
30
      control={control}
40
          control={control}
31
      error={errors.comment?.message}
41
          error={errors.comment?.message}
32
      rules={{ required: 'Este campo es requerido' }}
42
          rules={{ required: 'Este campo es requerido' }}
33
      onKeyDown={(e) => e.key === 'Enter' && submitHandler()}
43
          variant='search'
34
      variant='search'
44
          autoComplete='off'
-
 
45
        />
-
 
46
        <Button color='primary'>Publicar</Button>
-
 
47
      </Box>
35
    />
48
    </Form>
36
  )
49
  )