|
@@ -1,21 +1,77 @@
|
|
-import TextField from '@material-ui/core/TextField';
|
|
|
|
import { makeStyles } from "@material-ui/core/styles";
|
|
import { makeStyles } from "@material-ui/core/styles";
|
|
import SendIcon from '@mui/icons-material/Send';
|
|
import SendIcon from '@mui/icons-material/Send';
|
|
import MicNoneIcon from '@mui/icons-material/MicNone';
|
|
import MicNoneIcon from '@mui/icons-material/MicNone';
|
|
|
|
+import AttachFileIcon from '@mui/icons-material/AttachFile';
|
|
|
|
+import SentimentSatisfiedAltIcon from '@mui/icons-material/SentimentSatisfiedAlt';
|
|
|
|
+import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
|
|
import Avatar from '@mui/material/Avatar';
|
|
import Avatar from '@mui/material/Avatar';
|
|
|
|
+import { useState } from "react";
|
|
|
|
+
|
|
|
|
|
|
const useStyles = makeStyles({
|
|
const useStyles = makeStyles({
|
|
- form : {
|
|
|
|
|
|
+ absoluteContainer:{
|
|
|
|
+ // position: 'relative'
|
|
|
|
+ },
|
|
|
|
+ container : {
|
|
display: "flex",
|
|
display: "flex",
|
|
justifyContent: "space-between",
|
|
justifyContent: "space-between",
|
|
- alignContent: 'center',
|
|
|
|
- alignItems:'center',
|
|
|
|
|
|
+ alignContent: 'flex-end',
|
|
|
|
+ alignItems:'flex-end',
|
|
width: 700,
|
|
width: 700,
|
|
position: 'fixed',
|
|
position: 'fixed',
|
|
bottom: 20,
|
|
bottom: 20,
|
|
},
|
|
},
|
|
- input : {
|
|
|
|
- width: 620
|
|
|
|
|
|
+ inputContainer: {
|
|
|
|
+ position:'relative',
|
|
|
|
+ width: '100%',
|
|
|
|
+ display: 'flex',
|
|
|
|
+ flexWrap: 'nowrap',
|
|
|
|
+ alignContent: 'center',
|
|
|
|
+ alignItems:'center',
|
|
|
|
+ color: '#6b6b6b',
|
|
|
|
+ backgroundColor: '#ffffff',
|
|
|
|
+ borderRadius: 8,
|
|
|
|
+ padding: 10,
|
|
|
|
+ marginRight: 10,
|
|
|
|
+ "&:after": {
|
|
|
|
+ content: "''",
|
|
|
|
+ position: "absolute",
|
|
|
|
+ width: "0",
|
|
|
|
+ height: "0",
|
|
|
|
+ borderBottom: "15px solid #ffffff",
|
|
|
|
+ borderLeft: "15px solid transparent",
|
|
|
|
+ borderRight: "15px solid transparent",
|
|
|
|
+ bottom: "0",
|
|
|
|
+ right: "-15px"
|
|
|
|
+ },
|
|
|
|
+ "&:before": {
|
|
|
|
+ content: "''",
|
|
|
|
+ position: "absolute",
|
|
|
|
+ width: "0",
|
|
|
|
+ height: "0",
|
|
|
|
+ borderBottom: "17px solid #ffffff",
|
|
|
|
+ borderLeft: "16px solid transparent",
|
|
|
|
+ borderRight: "16px solid transparent",
|
|
|
|
+ bottom: "-1px",
|
|
|
|
+ right: "-17px"
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ textarea : {
|
|
|
|
+ width: '100%',
|
|
|
|
+ outline: 'none',
|
|
|
|
+ border:'none',
|
|
|
|
+ padding: '0px 10px',
|
|
|
|
+ marginLeft: 8,
|
|
|
|
+ marginRight: 8,
|
|
|
|
+ overflowY:'auto',
|
|
|
|
+ resize: 'none',
|
|
|
|
+ height: 'auto',
|
|
|
|
+ '&:focus': {
|
|
|
|
+ height:66
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ attachIcon: {
|
|
|
|
+ transform: 'rotate(30deg)'
|
|
},
|
|
},
|
|
avatar: {
|
|
avatar: {
|
|
'&:hover': {
|
|
'&:hover': {
|
|
@@ -23,23 +79,64 @@ const useStyles = makeStyles({
|
|
color: '#ffffff',
|
|
color: '#ffffff',
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ avatarArrow: {
|
|
|
|
+ position: 'static',
|
|
|
|
+ left: 175,
|
|
|
|
+ bottom:-400,
|
|
|
|
+ '&:hover': {
|
|
|
|
+ backgroundColor: 'rgb(41, 139, 231)',
|
|
|
|
+ color: '#ffffff',
|
|
|
|
+ }
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
-const SendMessage = () => {
|
|
|
|
|
|
+interface ISendMessage{
|
|
|
|
+ setChat:any,
|
|
|
|
+ isArrow:boolean,
|
|
|
|
+ handleArrow:() => void
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const SendMessage = ({setChat,isArrow,handleArrow}:ISendMessage) => {
|
|
const classes = useStyles();
|
|
const classes = useStyles();
|
|
|
|
+ const [value,setValue] = useState<string>('')
|
|
|
|
+ const handleTextarea = (e: React.ChangeEvent<HTMLTextAreaElement>) => setValue(e.target.value)
|
|
|
|
+ const sentMessage = () => {
|
|
|
|
+ const newMessage = {
|
|
|
|
+ avatarUrl: 'https://www.seekpng.com/png/full/114-1149126_apple-clipart-black-and-white-image-small-clip.png',
|
|
|
|
+ name: 'Grigore',
|
|
|
|
+ lastName: 'Omelchenko',
|
|
|
|
+ message: value,
|
|
|
|
+ }
|
|
|
|
+ setChat((prevState: any) => [...prevState, newMessage])
|
|
|
|
+ setValue('')
|
|
|
|
+ }
|
|
|
|
+
|
|
return (
|
|
return (
|
|
- <>
|
|
|
|
- <form className={classes.form} noValidate autoComplete="off">
|
|
|
|
- <TextField
|
|
|
|
- label="Write a new message"
|
|
|
|
- className={classes.input}
|
|
|
|
- />
|
|
|
|
- <Avatar className={classes.avatar} sx={{
|
|
|
|
|
|
+ <>
|
|
|
|
+ <div className={classes.container} >
|
|
|
|
+ <div className={classes.inputContainer}>
|
|
|
|
+ <SentimentSatisfiedAltIcon fontSize='medium'/>
|
|
|
|
+ <textarea value={value} onChange={handleTextarea} className={classes.textarea}
|
|
|
|
+ placeholder='Message' rows={1} cols={20}/>
|
|
|
|
+ <AttachFileIcon className={classes.attachIcon} fontSize='medium' />
|
|
|
|
+ </div>
|
|
|
|
+ {value ?
|
|
|
|
+ <Avatar onClick={sentMessage} className={classes.avatar} sx={{
|
|
backgroundColor: '#ffffff',
|
|
backgroundColor: '#ffffff',
|
|
width: 56, height: 56 ,color: 'rgb(41, 139, 231)'}}>
|
|
width: 56, height: 56 ,color: 'rgb(41, 139, 231)'}}>
|
|
<SendIcon fontSize="medium" />
|
|
<SendIcon fontSize="medium" />
|
|
- </Avatar>
|
|
|
|
- </form>
|
|
|
|
|
|
+ </Avatar> :
|
|
|
|
+ <Avatar className={classes.avatar} sx={{
|
|
|
|
+ backgroundColor: '#ffffff',
|
|
|
|
+ width: 56, height: 56 ,color: '#6b6b6b'}}>
|
|
|
|
+ <MicNoneIcon fontSize="medium" />
|
|
|
|
+ </Avatar>}
|
|
|
|
+ </div>
|
|
|
|
+ {<Avatar onClick={handleArrow} className={classes.avatarArrow} sx={{
|
|
|
|
+ backgroundColor: '#ffffff',
|
|
|
|
+ width: 56, height: 56 ,color: '#6b6b6b'}}>
|
|
|
|
+ <ArrowDownwardIcon fontSize="medium" />
|
|
|
|
+ </Avatar>}
|
|
</>
|
|
</>
|
|
)
|
|
)
|
|
}
|
|
}
|