'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _HeaderWrapper = require('./styles/HeaderWrapper');

var _HeaderWrapper2 = _interopRequireDefault(_HeaderWrapper);

var _CardHeaderText = require('./styles/CardHeaderText');

var _CardHeaderText2 = _interopRequireDefault(_CardHeaderText);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var CardHeader = function (_React$Component) {
  (0, _inherits3.default)(CardHeader, _React$Component);

  function CardHeader() {
    (0, _classCallCheck3.default)(this, CardHeader);
    return (0, _possibleConstructorReturn3.default)(this, (CardHeader.__proto__ || (0, _getPrototypeOf2.default)(CardHeader)).apply(this, arguments));
  }

  (0, _createClass3.default)(CardHeader, [{
    key: 'render',
    value: function render() {
      var _props = this.props,
          image = _props.image,
          title = _props.title,
          HeaderWrapper = _props.HeaderWrapper,
          CardHeaderText = _props.CardHeaderText;


      return _react2.default.createElement(
        HeaderWrapper,
        { image: image },
        title ? _react2.default.createElement(
          CardHeaderText,
          null,
          title
        ) : null
      );
    }
  }]);
  return CardHeader;
}(_react2.default.Component);

CardHeader.propTypes = {
  /**
   * The text to be displayed in the header.  Optional.  Text is displayed in white font by default.
   */
  title: _propTypes2.default.string,
  /**
   * The image to be displayed as the background of the header.  If omitted, no background image is used.
   */
  image: _propTypes2.default.string,
  /**
   * A component which controls the styling of the CardHeader
   */
  HeaderWrapper: _propTypes2.default.func,
  /**
   * A component which controls the appearance of the text in the Card Header
   */
  CardHeaderText: _propTypes2.default.func
};
CardHeader.defaultProps = {
  title: null,
  image: null,
  HeaderWrapper: _HeaderWrapper2.default,
  CardHeaderText: _CardHeaderText2.default
};
exports.default = CardHeader;