import React from 'react';
import PropTypes from 'prop-types';
import Icon from '../Common/Icon';
import User from '../User/User';
export default class Attachment extends React.Component {
constructor(props) {
super(props);
this._onAttachmentDeleteClicked = this._onAttachmentDeleteClicked.bind(this);
}
iconNameByFormat(format) {
if (format.match(/image\/.+/i)) {
return 'file-image-o';
}
return 'file-o';
}
_onAttachmentDeleteClicked(event) {
this.props.onAttachmentDeleteClicked(this.props.attachment);
}
render() {
const attachment = this.props.attachment;
const attachmentId = attachment._id
const formatIcon = this.iconNameByFormat(attachment.fileFormat);
let fileInUse = '';
if (this.props.inUse) {
fileInUse = In Use;
}
const fileType = {attachment.fileFormat};
const btnTrash = (this.props.isUserLoggedIn)
?