All files / components/content-header content-header.jsx

100% Statements 3/3
50% Branches 3/6
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              4x                         2x                     2x            
import React from 'react';
import ReactDOM from 'react-dom';
import Breadcrumbs from './breadcrumbs.jsx';
import PropTypes from 'prop-types';
 
class ContentHeader extends React.Component {
  render() {
    return (
      <section className="content-header">
        <h1>
          {this.props.heading}
          {this.props.subheading ? ' ' : ''}
          {this.props.subheading ? <small>{this.props.subheading}</small> : ''}
        </h1>
        {this.props.breadcrumbs ? <Breadcrumbs /> : ''}
        {this.props.children}
      </section>
    );
  }
}
ContentHeader.propTypes = {
  heading: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.element
  ]),
  subheading: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.element
  ]),
  breadcrumbs: PropTypes.bool
};
ContentHeader.defaultProps = {
  heading: '',
  breadcrumbs: false
};
 
export default ContentHeader;