import React from 'react'; import PropTypes from 'prop-types'; import { Button, Modal } from 'react-bootstrap'; import moment from 'moment/src/moment'; import ReactUtils from '../ReactUtils'; import UserPicture from '../User/UserPicture'; export default class DeleteCommentModal extends React.Component { constructor(props) { super(props); } componentWillMount() { } render() { if (this.props.comment === undefined) { return
} const comment = this.props.comment; const commentDate = moment(comment.createdAt).format('YYYY/MM/DD HH:mm'); let commentBody = comment.comment if (commentBody.length > 200) { // omit commentBody = commentBody.substr(0,200) + '...'; } commentBody = ReactUtils.nl2br(commentBody); return ( Delete comment? {comment.creator.username} wrote on {commentDate}:

{commentBody}

); } } DeleteCommentModal.propTypes = { isShown: PropTypes.bool.isRequired, comment: PropTypes.object, cancel: PropTypes.func.isRequired, // for cancel evnet handling confirmedToDelete: PropTypes.func.isRequired, // for confirmed event handling };