index.tsx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 { firstLetter,slicedWord } from "../../../../../../helpers";
  7. import { TMessage } from "../../../../../../typescript/redux/messages/types";
  8. const useStyles = makeStyles({
  9. replyTop : {
  10. position: 'absolute',
  11. left: 0,
  12. top: '-7vh',
  13. height: '6vh',
  14. width: '100%',
  15. borderRadius: 8,
  16. display: 'flex',
  17. flexWrap: 'nowrap',
  18. alignContent: 'center',
  19. alignItems: 'center',
  20. color: '#6b6b6b',
  21. border:'solid 2px rgb(41, 139, 231)',
  22. backgroundColor: '#ffffff',
  23. padding: '0px 5px',
  24. zIndex:2,
  25. },
  26. replyIconClose: {
  27. cursor: 'pointer',
  28. marginLeft: 5,
  29. marginRight: 5,
  30. '&:hover': {
  31. color:'#f02a2a',
  32. transform: 'rotate(180deg)',
  33. transition: 'all 250ms ease-out ',
  34. }
  35. },
  36. replyListWrapper: {
  37. width: '100%',
  38. },
  39. replyColumn: {
  40. height: '80%',
  41. width: 2,
  42. backgroundColor: 'rgb(41, 139, 231)',
  43. marginRight:10
  44. },
  45. });
  46. interface IReplyBar {
  47. isReply:TMessage,
  48. handleCloseReply: () => void,
  49. handleScrollToTheMessage:(_id:string) => void
  50. }
  51. const ReplyBar = ({ isReply, handleCloseReply,handleScrollToTheMessage }: IReplyBar) => {
  52. const classes = useStyles();
  53. return (
  54. <div className={classes.replyTop}>
  55. <ReplyIcon style={{margin:'0px 7px',color: "rgb(41, 139, 231)"}}/>
  56. <div className={classes.replyColumn}></div>
  57. <ul className={classes.replyListWrapper}>
  58. <MenuItem onClick={() => handleScrollToTheMessage(isReply._id)}>
  59. <ListItemText
  60. primary={`${firstLetter(isReply.name)}${slicedWord(isReply.name, 15, 1)}
  61. ${firstLetter(isReply.lastName)}${slicedWord(isReply.lastName, 15, 1)}`}
  62. primaryTypographyProps={{ color: "rgb(41, 139, 231)",fontSize:16 }}
  63. secondary={`Type : ${isReply.type.toUpperCase()}`}
  64. secondaryTypographyProps={{ fontSize:16 }}/>
  65. </MenuItem>
  66. </ul>
  67. <CloseIcon onClick={handleCloseReply} className={classes.replyIconClose} />
  68. </div>
  69. )
  70. }
  71. export default ReplyBar