index.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. marginRight: 5,
  34. '&:hover': {
  35. color:'#f02a2a',
  36. transform: 'rotate(180deg)',
  37. transition: 'all 250ms ease-out ',
  38. }
  39. },
  40. editColumn: {
  41. height: '80%',
  42. width: 2,
  43. backgroundColor: 'rgb(41, 139, 231)',
  44. marginRight:10
  45. },
  46. });
  47. interface IEditBar {
  48. isEdit:TMessage,
  49. handleCloseEdit: () => void,
  50. handleScrollToTheMessage:(_id:string) => void
  51. }
  52. const EditBar = ({ isEdit, handleCloseEdit,handleScrollToTheMessage }: IEditBar) => {
  53. const classes = useStyles();
  54. return (
  55. <div className={classes.editTop}>
  56. <EditIcon style={{margin:'0px 7px',color: "rgb(41, 139, 231)"}}/>
  57. <div className={classes.editColumn}></div>
  58. <ul className={classes.editListWrapper}>
  59. <li onClick={() => handleScrollToTheMessage(isEdit._id)}>
  60. <ListItemText
  61. primary={`Edit ${isEdit.type === 'text'?'Message and Caption':'only Caption'}`}
  62. primaryTypographyProps={{ color: "rgb(41, 139, 231)",fontSize:16 }}
  63. secondary={isEdit.type === 'text' ? `Message: ${isEdit.message} , Caption: ${isEdit.caption}`:`Caption: ${isEdit.caption}`}
  64. secondaryTypographyProps={{ fontSize: 16}} />
  65. </li>
  66. </ul>
  67. <CloseIcon onClick={handleCloseEdit} className={classes.editIconClose} />
  68. </div>
  69. )
  70. }
  71. export default EditBar