import React from 'react'; import PropTypes from 'prop-types'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter, } from 'reactstrap'; import { format } from 'date-fns'; import { UserPicture } from '@growi/ui'; import Username from '../User/Username'; export default class DeleteCommentModal extends React.Component { /* * the threshold for omitting body */ static get OMIT_BODY_THRES() { return 400 } UNSAFE_componentWillMount() { } render() { if (this.props.comment === undefined) { return
; } const comment = this.props.comment; const commentDate = format(new Date(comment.createdAt), 'yyyy/MM/dd HH:mm'); // generate body let commentBody = comment.comment; if (commentBody.length > DeleteCommentModal.OMIT_BODY_THRES) { // omit commentBody = `${commentBody.substr(0, DeleteCommentModal.OMIT_BODY_THRES)}...`; } commentBody = {commentBody}; return ({commentBody}