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

100% Statements 6/6
50% Branches 1/2
50% Functions 2/4
100% Lines 6/6
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 1x                           1x                   1x              
import React from 'react';
import PropTypes from 'prop-types';
 
class TimelineHeader extends React.Component {
  render() {
    return (
      <h3 className="timeline-header">
        <a
          href={this.props.url}
          onClick={this.props.onClick ? e => {
            e.preventDefault();
            e.stopPropagation();
            this.props.onClick();
          } : () => {}}
          target="_blank"
        >
          {this.props.title}
        </a>
        &nbsp;
        {this.props.content}
        {this.props.children}
      </h3>
    );
  }
}
 
TimelineHeader.propTypes = {
  title: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.element
  ]),
  content: PropTypes.any,
  onClick: PropTypes.func,
  url: PropTypes.string
};
 
TimelineHeader.defaultProps = {
  onClick: () => {},
  title: '',
  content: ''
};
 
export default TimelineHeader;