Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3596 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react';
import { Typography } from '@mui/material';

import { formatDate } from '@shared/utils';
import colors from '@styles/config/colors';

import { Card, CardContent, CardHeader } from '../card';
import { Menu } from '../menu';

export function CommentItem({
  comment: { image, fullname, date = '2023-02-04T20:15:12', comment: content },
  onDelete,
  onReport
}) {
  return (
    <Card sx={{ backgroundColor: colors.dark }}>
      <CardHeader
        avatar={image}
        title={fullname}
        subheader={formatDate(date)}
        renderAction={() => (
          <Menu>
            {onDelete && <Menu.Item onClick={onDelete}>Eliminar</Menu.Item>}
            {onReport && <Menu.Item onClick={onReport}>Reportar</Menu.Item>}
          </Menu>
        )}
      />

      <CardContent>
        <Typography>{content}</Typography>
      </CardContent>
    </Card>
  );
}