Rev 3628 | Rev 3635 | 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 { Form, FormHiddenInput, FormInput } from '@shared/components';export const ChatForm = ({ onSubmit }) => {const handleSubmit = (data) => {if (!data.message && !data.file) return;const message = {message: data.message,file: data.file ? data.file[0] : null};onSubmit(message);};return (<FormdefaultValues={{ message: '', file: null }}resetonSubmit={handleSubmit}style={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}><IconButton component='label' role={undefined} variant='contained' tabIndex={-1}><AttachFile /><FormHiddenInput name='file' type='file' /></IconButton><FormInputname='message'placeholder='Escribe un mensaje'autoComplete='off'endAdornment={<IconButton type='submit' sx={{ padding: 0.4 }}><SendRounded /></IconButton>}/></Form>);};