All files / components/header-bar/header-messages message-item.jsx

100% Statements 3/3
50% Branches 1/2
100% Functions 1/1
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44          1x                                           1x               1x                
import React from 'react';
import PropTypes from 'prop-types';
 
class MessageItem extends React.Component {
  render() {
    return (
      <li>
        <a href={this.props.link} onClick={this.props.onClick}>
          <div className="pull-left">
            <img src={this.props.displayImg} className="img-circle" alt="User image" />
          </div>
          <h4>
            {this.props.title}
            {this.props.time ? (
              <small>
                <i className="fa fa-clock-o" />
                &nbsp;
                {this.props.time}
              </small>
            ) : ''}
          </h4>
          <p>{this.props.content}</p>
        </a>
      </li>
    );
  }
}
MessageItem.propTypes = {
  title: PropTypes.string,
  content: PropTypes.string,
  time: PropTypes.string,
  displayImg: PropTypes.string,
  link: PropTypes.string,
  onClick: PropTypes.func
};
MessageItem.defaultProps = {
  title: '',
  content: '',
  time: '',
  displayImg: ''
};
 
export default MessageItem;