index.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { makeStyles } from "@material-ui/core/styles";
  2. import CloseIcon from '@mui/icons-material/Close';
  3. import EditIcon from '@mui/icons-material/Edit';
  4. import ListItemText from '@mui/material/ListItemText';
  5. import { TMessage } from "../../../../../../typescript/redux/messages/types";
  6. const useStyles = makeStyles({
  7. editTop : {
  8. position: 'absolute',
  9. left: 0,
  10. top: '-7vh',
  11. height: '6vh',
  12. width: '100%',
  13. borderRadius: 8,
  14. display: 'flex',
  15. flexWrap: 'nowrap',
  16. alignContent: 'center',
  17. alignItems: 'center',
  18. color: '#6b6b6b',
  19. border:'solid 2px rgb(41, 139, 231)',
  20. backgroundColor: '#ffffff',
  21. padding: '0px 5px',
  22. zIndex:2,
  23. },
  24. editListWrapper: {
  25. width: '100%',
  26. wordBreak: 'break-word',
  27. overflowY: "auto",
  28. height: '6vh',
  29. },
  30. editIconClose: {
  31. cursor: 'pointer',
  32. marginLeft:5,
  33. '&:hover': {
  34. color:'#f02a2a',
  35. transform: 'rotate(180deg)',
  36. transition: 'all 250ms ease-out ',
  37. }
  38. },
  39. editColumn: {
  40. height: '80%',
  41. width: 2,
  42. backgroundColor: '#00aeff',
  43. marginRight:10
  44. },
  45. });
  46. interface IEditBar {
  47. isEdit:TMessage,
  48. handleCloseEdit: () => void,
  49. handleScrollToTheMessage:(_id:string) => void
  50. }
  51. const EditBar = ({ isEdit, handleCloseEdit,handleScrollToTheMessage }: IEditBar) => {
  52. const classes = useStyles();
  53. return (
  54. <div className={classes.editTop}>
  55. <EditIcon style={{margin:'0px 7px',color: "#0694d6"}}/>
  56. <div className={classes.editColumn}></div>
  57. <ul className={classes.editListWrapper}>
  58. <li onClick={() => handleScrollToTheMessage(isEdit._id)}>
  59. <ListItemText
  60. primary={`Edit ${isEdit.type === 'text'?'Message or Caption':'Caption'}`}
  61. primaryTypographyProps={{ color: "#0379af",fontSize:16 }}
  62. secondary={isEdit.type === 'text'?`Message: ${isEdit.message} , Caption: ${isEdit.caption}`:`Caption: ${isEdit.caption}`}
  63. secondaryTypographyProps={{ fontSize: 16}} />
  64. </li>
  65. </ul>
  66. <CloseIcon onClick={handleCloseEdit} className={classes.editIconClose} />
  67. </div>
  68. )
  69. }
  70. export default EditBar