Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3628 Rev 3634
Línea 3... Línea 3...
3
import { AttachFile, SendRounded } from '@mui/icons-material';
3
import { AttachFile, SendRounded } from '@mui/icons-material';
Línea 4... Línea 4...
4
 
4
 
Línea 5... Línea 5...
5
import { Form, FormHiddenInput, FormInput } from '@shared/components';
5
import { Form, FormHiddenInput, FormInput } from '@shared/components';
-
 
6
 
-
 
7
export const ChatForm = ({ onSubmit }) => {
-
 
8
  const handleSubmit = (data) => {
-
 
9
    if (!data.message && !data.file) return;
-
 
10
    const message = {
-
 
11
      message: data.message,
-
 
12
      file: data.file ? data.file[0] : null
-
 
13
    };
-
 
14
    onSubmit(message);
6
 
15
  };
7
export const ChatForm = ({ onSubmit }) => {
16
 
8
  return (
17
  return (
9
    <Form
18
    <Form
10
      defaultValues={{ message: '' }}
19
      defaultValues={{ message: '', file: null }}
11
      reset
20
      reset
12
      onSubmit={onSubmit}
21
      onSubmit={handleSubmit}
13
      style={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}
22
      style={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}
14
    >
23
    >
15
      <IconButton component='label' role={undefined} variant='contained' tabIndex={-1}>
24
      <IconButton component='label' role={undefined} variant='contained' tabIndex={-1}>
16
        <AttachFile />
25
        <AttachFile />
17
        <FormHiddenInput name='file' type='file' />
26
        <FormHiddenInput name='file' type='file' />
18
      </IconButton>
27
      </IconButton>
19
      <FormInput
28
      <FormInput
20
        name='message'
-
 
21
        placeholder='Escribe un mensaje'
29
        name='message'
22
        rules={{ required: true }}
30
        placeholder='Escribe un mensaje'
23
        autoComplete='off'
31
        autoComplete='off'
24
        endAdornment={
32
        endAdornment={
25
          <IconButton type='submit' sx={{ padding: 0.4 }}>
33
          <IconButton type='submit' sx={{ padding: 0.4 }}>