All files / components/timeline/timeline-item timeline-item.jsx

100% Statements 12/12
50% Branches 3/6
100% Functions 1/1
100% Lines 12/12
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71                1x 1x 1x 1x 1x           1x 1x           1x 1x                 1x                                 1x               1x                    
import React from 'react';
import TimelineHeader from './timeline-header.jsx';
import TimelineBody from './timeline-body.jsx';
import TimelineFooter from './timeline-footer.jsx';
import PropTypes from 'prop-types';
 
class TimelineItem extends React.Component {
  render() {
    let body = '';
    let footer = '';
    let header = '';
    Eif (this.props.body) {
      body = (
        <TimelineBody content={this.props.body.content}>
          {this.props.body.markup}
        </TimelineBody>
      );
    }
    Eif (this.props.footer) {
      footer = (
        <TimelineFooter content={this.props.footer.content}>
          {this.props.footer.markup}
        </TimelineFooter>
      );
    }
    Eif (this.props.header) {
      header = (
        <TimelineHeader
          url={this.props.header.url}
          onClick={this.props.header.onClick}
          title={this.props.header.title}
          content={this.props.header.content}
        />
      );
    }
    return (
      <li>
        <i className={`${this.props.icon} ${this.props.iconTheme}`} />
        <div className="timeline-item">
          <span className="time">
            <i className="fa fa-clock-o" />
            &nbsp;
            {this.props.time}
          </span>
          {header}
          {body}
          {footer}
        </div>
      </li>
    );
  }
}
TimelineItem.propTypes = {
  icon: PropTypes.string,
  iconTheme: PropTypes.string,
  time: PropTypes.string,
  header: PropTypes.object,
  body: PropTypes.object,
  footer: PropTypes.object
};
TimelineItem.defaultProps = {
  icon: 'fa fa-coffee',
  iconTheme: 'bg-blue',
  time: '',
  header: {},
  body: {},
  footer: {}
};
 
export default TimelineItem;