Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3635 | Rev 3639 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3622 stevensc 1
import React from 'react';
2
import { IconButton } from '@mui/material';
3
import { AttachFile, SendRounded } from '@mui/icons-material';
4
 
3638 stevensc 5
import { FileModal, Form, FormInput } from '@shared/components';
6
import { useModal } from '@shared/hooks';
3622 stevensc 7
 
8
export const ChatForm = ({ onSubmit }) => {
3638 stevensc 9
  const { showModal, closeModal } = useModal();
10
 
11
  const attachFile = () => {
12
    showModal(
13
      'Elegir archivo',
14
      <FileModal
15
        onSubmit={(data) => {
16
          onSubmit(data);
17
          closeModal();
18
        }}
19
      />
20
    );
3634 stevensc 21
  };
3622 stevensc 22
  return (
3628 stevensc 23
    <Form
3638 stevensc 24
      defaultValues={{ message: '' }}
3628 stevensc 25
      reset
3638 stevensc 26
      onSubmit={onSubmit}
3628 stevensc 27
      style={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}
28
    >
3638 stevensc 29
      <IconButton onClick={attachFile}>
3622 stevensc 30
        <AttachFile />
31
      </IconButton>
32
      <FormInput
33
        name='message'
34
        placeholder='Escribe un mensaje'
35
        autoComplete='off'
36
        endAdornment={
37
          <IconButton type='submit' sx={{ padding: 0.4 }}>
38
            <SendRounded />
39
          </IconButton>
40
        }
41
      />
42
    </Form>
43
  );
44
};