/* eslint no-unused-vars:0 */
'use strict';

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

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _lodash = require('lodash');

var _lodash2 = _interopRequireDefault(_lodash);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _LeadingImage = {
  "extended-leading-img": "LeadingImage__extended-leading-img___3_6cg",
  "leading-img": "LeadingImage__leading-img___1B9Y1",
  "small-leading-img": "LeadingImage__small-leading-img___30M4A"
};

var _LeadingImage2 = _interopRequireDefault(_LeadingImage);

var _Image = require('./Image');

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

// eslint-disable-line

var LeadingImage = function (_React$Component) {
  _inherits(LeadingImage, _React$Component);

  function LeadingImage(props) {
    _classCallCheck(this, LeadingImage);

    return _possibleConstructorReturn(this, (LeadingImage.__proto__ || Object.getPrototypeOf(LeadingImage)).call(this, props));
  }

  _createClass(LeadingImage, [{
    key: 'render',
    value: function render() {
      var _props = this.props;
      var size = _props.size;
      var image = _props.image;
      var id = _props.id;
      var description = _props.description;

      var leadingImgClass = void 0;
      if (!image) {
        return null;
      }
      switch (size) {
        case 'normal':
          leadingImgClass = 'leading-img';
          break;
        case 'extend':
          leadingImgClass = 'extended-leading-img';
          break;
        case 'small':
          leadingImgClass = 'small-leading-img';
          break;
        default:
          leadingImgClass = 'leading-img';
          break;
      }

      return _react2.default.createElement(
        'div',
        { className: _LeadingImage2.default[leadingImgClass] },
        _react2.default.createElement(_Image.Image, {
          content: [_lodash2.default.assign({}, image, { id: id, description: description })],
          isToShowDescription: false
        })
      );
    }
  }]);

  return LeadingImage;
}(_react2.default.Component);

LeadingImage.propTypes = {
  size: _react2.default.PropTypes.string,
  image: _react2.default.PropTypes.object,
  description: _react2.default.PropTypes.string,
  id: _react2.default.PropTypes.string
};

LeadingImage.defaultProps = {
  size: 'normal',
  image: null,
  description: '',
  id: ''
};

exports.LeadingImage = LeadingImage;