index.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { makeStyles } from "@material-ui/core/styles";
  2. import { IconButton } from "@material-ui/core";
  3. import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
  4. import FileDownloadIcon from '@mui/icons-material/FileDownload';
  5. import { timeStampMessage } from '../../../../../../helpers'
  6. const useStyles = makeStyles({
  7. container: {
  8. display: "flex",
  9. justifyContent: "flex-end",
  10. width:'auto',
  11. maxWidth: '80%',
  12. marginBottom:15
  13. },
  14. wrapper: {
  15. position: 'relative',
  16. display: 'flex',
  17. justifyContent: 'space-between',
  18. alignContent: 'center',
  19. alignItems: 'center',
  20. width: 250,
  21. padding: '5px 5px 12px 5px',
  22. backgroundColor: '#deffa9',
  23. borderRadius: 7,
  24. "&:after": {
  25. content: "''",
  26. position: "absolute",
  27. width: "0",
  28. height: "0",
  29. borderBottom: "15px solid #deffa9",
  30. borderLeft: "15px solid transparent",
  31. borderRight: "15px solid transparent",
  32. bottom: "0",
  33. right: "-15px"
  34. },
  35. "&:before": {
  36. content: "''",
  37. position: "absolute",
  38. width: "0",
  39. height: "0",
  40. borderBottom: "17px solid #deffa9",
  41. borderLeft: "16px solid transparent",
  42. borderRight: "16px solid transparent",
  43. bottom: "0px",
  44. right: "-17px"
  45. }
  46. },
  47. bntDownload: {
  48. backgroundColor: '#deffa9',
  49. color: '#54b0fc',
  50. width: 30,
  51. height:30,
  52. '&:hover': {
  53. backgroundColor: '#54b0fc',
  54. color:'#ffffff'
  55. }
  56. },
  57. title: {
  58. margin: '0 30px 0 5px',
  59. color: '#0e0d0d'
  60. },
  61. time: {
  62. position: "absolute",
  63. fontSize: ".65em",
  64. fontWeight:600,
  65. bottom: 0,
  66. right: 6,
  67. color: '#414141',
  68. padding: 3,
  69. borderRadius: 5,
  70. zIndex:10
  71. },
  72. });
  73. interface IMessageLeftFile {
  74. audioUrl:string,
  75. updatedAt: string,
  76. }
  77. const MessageLeftFile = ({ audioUrl,updatedAt }:IMessageLeftFile) => {
  78. const classes = useStyles();
  79. return (
  80. <div className={classes.container}>
  81. <div className={classes.wrapper}>
  82. <InsertDriveFileIcon fontSize='large' style={{ color:'#5f5f5f'}}/>
  83. <span className={classes.title}>Application File</span>
  84. <a href={`http://localhost:3000/${audioUrl}`} target="_blank" rel="noreferrer" download>
  85. <IconButton className={classes.bntDownload} >
  86. <FileDownloadIcon fontSize='small'/>
  87. </IconButton>
  88. </a>
  89. <div className={classes.time}>{timeStampMessage(updatedAt)}</div>
  90. </div>
  91. </div>
  92. )};
  93. export default MessageLeftFile