Proyectos de Subversion LeadersLinked - SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3481 stevensc 1
import React from 'react';
2
import { Avatar, Box, IconButton, styled, Typography } from '@mui/material';
3
import { DeleteOutline } from '@mui/icons-material';
4
 
5
import { parse } from '@utils';
3535 stevensc 6
 
3481 stevensc 7
import { CapsuleRating } from './UI';
3535 stevensc 8
import { formatDate } from '@shared/utils';
3481 stevensc 9
 
10
const CommentContainer = styled(Box)`
11
  background-color: ${(props) => props.theme.background.color.primary};
12
  padding: 0.5rem;
13
  display: flex;
14
  justify-content: space-between;
15
  gap: 0.5rem;
16
`;
17
 
18
export const CapsuleComment = ({
19
  comment: { image, fullname, comment: content, rating, date, link_delete },
20
  onDelete
21
}) => {
22
  return (
23
    <CommentContainer>
24
      <Box display='flex' gap={1} alignItems='center'>
25
        <Avatar src={image} alt={fullname} sx={{ width: 60, height: 60 }} />
26
 
27
        <Box display='flex' flexDirection='column'>
28
          <Typography variant='h3'>{fullname}</Typography>
29
          <Typography>{parse(content)}</Typography>
30
          <CapsuleRating readOnly max={5} value={rating} size='small' />
31
        </Box>
32
      </Box>
33
 
34
      <Box display='flex' flexDirection='column' justifyContent='space-between' alignItems='end'>
35
        {link_delete && (
36
          <IconButton onClick={() => onDelete(link_delete)}>
37
            <DeleteOutline />
38
          </IconButton>
39
        )}
40
 
41
        <span>{formatDate(date)}</span>
42
      </Box>
43
    </CommentContainer>
44
  );
45
};