all files / components/ TitleAndDescription.js

88.57% Statements 31/35
57.58% Branches 19/33
100% Functions 11/11
100% Lines 7/7
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                                                                      
import React from 'react';IEE
import PropTypes from 'prop-types';EIII
 
class TitleAndDescription extends React.Component {
  componentDidMount() {
    // some logic here - we only test if the method is called
  }
  render() {
    return (
      <div className="page-intro background--gallery">
        <div className="wrapper">
          <div className="col-wrap">
            <div className="col">
              <div className="col col--md-47 col--lg-48">
                <h1 className="page-intro__title">
                  {this.props.title}
                </h1>
                <p className={`page-intro__content margin-bottom--${this.props.marginBottom}`}>
                  {this.props.description}
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  }
}
 
TitleAndDescription.defaultProps = {
  marginBottom: '1',
  description: '',
};
 
TitleAndDescription.propTypes = {
  title: PropTypes.string.isRequired,
  description: PropTypes.string,
  marginBottom: PropTypes.string,
};
 
export default TitleAndDescription;