import React from 'react';
import PropTypes from 'prop-types';
class Attachment extends React.Component {
render() {
return (
<div className="attachment-block clearfix">
<img className="attachment-img" src={this.props.img} alt="Attachment image" />
<div className="attachment-pushed">
<h4 className="attachment-heading">
<a
href={this.props.link}
onClick={this.props.onClick ? e => {
e.preventDefault();
e.stopPropagation();
this.props.onClick();
} : () => {}}
>
{this.props.title}
</a>
</h4>
<div className="attachment-text">
{this.props.content}
{this.props.children}
<a
href={this.props.link}
onClick={this.props.onClick ? e => {
e.preventDefault();
e.stopPropagation();
this.props.onClick();
} : () => {}}
>
More...
</a>
</div>
</div>
</div>
);
}
}
Attachment.propTypes = {
title: PropTypes.string,
link: PropTypes.string,
onClick: PropTypes.func,
img: PropTypes.string,
content: PropTypes.string
};
Attachment.defaultProps = {
title: '',
link: '',
img: '',
content: ''
};
export default Attachment;
|