index.tsx 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { makeStyles } from "@material-ui/core/styles";
  2. import CloseIcon from '@mui/icons-material/Close';
  3. import ReplyIcon from '@mui/icons-material/Reply';
  4. import MenuItem from '@mui/material/MenuItem';
  5. import ListItemText from '@mui/material/ListItemText';
  6. import LibraryMusicIcon from '@mui/icons-material/LibraryMusic';
  7. import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
  8. import ImageIcon from '@mui/icons-material/Image';
  9. import ContentCopyIcon from '@mui/icons-material/ContentCopy';
  10. import VideoLibraryIcon from '@mui/icons-material/VideoLibrary';
  11. import { firstLetter,slicedWord } from "../../../../../../helpers";
  12. import { TMessage } from "../../../../../../typescript/redux/messages/types";
  13. const useStyles = makeStyles({
  14. replyTop : {
  15. position: 'absolute',
  16. left: 0,
  17. top: '-7vh',
  18. height: '6vh',
  19. width: '100%',
  20. borderRadius: 8,
  21. display: 'flex',
  22. flexWrap: 'nowrap',
  23. alignContent: 'center',
  24. alignItems: 'center',
  25. color: '#6b6b6b',
  26. border:'solid 2px rgb(41, 139, 231)',
  27. backgroundColor: '#ffffff',
  28. padding: '0px 5px',
  29. zIndex:2,
  30. },
  31. replyIconClose: {
  32. cursor: 'pointer',
  33. marginLeft: 5,
  34. marginRight: 5,
  35. '&:hover': {
  36. color:'#f02a2a',
  37. transform: 'rotate(180deg)',
  38. transition: 'all 250ms ease-out ',
  39. }
  40. },
  41. replyListWrapper: {
  42. width: '100%',
  43. },
  44. replyColumn: {
  45. height: '80%',
  46. width: 2,
  47. backgroundColor: 'rgb(41, 139, 231)',
  48. marginRight:10
  49. },
  50. folderIcon: {
  51. color: '#54b0fc',
  52. },
  53. });
  54. interface IReplyBar {
  55. isReply:TMessage,
  56. handleCloseReply: () => void,
  57. handleScrollToTheMessage:(_id:string) => void
  58. }
  59. const ReplyBar = ({ isReply, handleCloseReply,handleScrollToTheMessage }: IReplyBar) => {
  60. const classes = useStyles();
  61. return (
  62. <div className={classes.replyTop}>
  63. <ReplyIcon style={{margin:'0px 7px',color: "rgb(41, 139, 231)"}}/>
  64. <div className={classes.replyColumn}></div>
  65. <ul className={classes.replyListWrapper}>
  66. <MenuItem onClick={() => handleScrollToTheMessage(isReply._id)}>
  67. <ListItemText
  68. primary={`${firstLetter(isReply.name)}${slicedWord(isReply.name, 15, 1)}
  69. ${firstLetter(isReply.lastName)}${slicedWord(isReply.lastName, 15, 1)}`}
  70. primaryTypographyProps={{ color: "rgb(41, 139, 231)",fontSize:16 }}
  71. secondary={`Type : ${isReply.type.toUpperCase()}`}
  72. secondaryTypographyProps={{ fontSize: 16 }} />
  73. {isReply.type === 'text' &&<ContentCopyIcon className={classes.folderIcon} fontSize='large' />}
  74. {isReply.type === 'audio' &&<LibraryMusicIcon className={classes.folderIcon} fontSize='large' />}
  75. {isReply.type === 'video' &&<VideoLibraryIcon className={classes.folderIcon} fontSize='large' />}
  76. {isReply.type === 'image' &&<ImageIcon className={classes.folderIcon} fontSize='large' />}
  77. {isReply.type === 'pdf'&&<InsertDriveFileIcon className={classes.folderIcon} fontSize='large' />}
  78. {isReply.type === 'docx'&&<InsertDriveFileIcon className={classes.folderIcon} fontSize='large' />}
  79. </MenuItem>
  80. </ul>
  81. <CloseIcon onClick={handleCloseReply} className={classes.replyIconClose} />
  82. </div>
  83. )
  84. }
  85. export default ReplyBar