Rev 3635 | Rev 3639 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';
import { IconButton } from '@mui/material';
import { AttachFile, SendRounded } from '@mui/icons-material';
import { FileModal, Form, FormInput } from '@shared/components';
import { useModal } from '@shared/hooks';
export const ChatForm = ({ onSubmit }) => {
const { showModal, closeModal } = useModal();
const attachFile = () => {
showModal(
'Elegir archivo',
<FileModal
onSubmit={(data) => {
onSubmit(data);
closeModal();
}}
/>
);
};
return (
<Form
defaultValues={{ message: '' }}
reset
onSubmit={onSubmit}
style={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}
>
<IconButton onClick={attachFile}>
<AttachFile />
</IconButton>
<FormInput
name='message'
placeholder='Escribe un mensaje'
autoComplete='off'
endAdornment={
<IconButton type='submit' sx={{ padding: 0.4 }}>
<SendRounded />
</IconButton>
}
/>
</Form>
);
};