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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BottomAuthor = 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 _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _lodash = require('lodash');

var _lodash2 = _interopRequireDefault(_lodash);

var _BottomAuthor = {
  "bottomAuthor": "BottomAuthor__bottomAuthor___Hvb-Z",
  "authorRow": "BottomAuthor__authorRow___1TLwv",
  "bioText": "BottomAuthor__bioText___3vpvo",
  "authorName": "BottomAuthor__authorName___1aH4I"
};

var _BottomAuthor2 = _interopRequireDefault(_BottomAuthor);

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; }

var BottomAuthor = exports.BottomAuthor = function (_Component) {
  _inherits(BottomAuthor, _Component);

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

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

  _createClass(BottomAuthor, [{
    key: 'setHtml',
    value: function setHtml(html) {
      return { __html: html };
    }
  }, {
    key: 'getAvatar',
    value: function getAvatar(author) {
      return _lodash2.default.get(author, ['image', 'url'], 'https://ssl.gstatic.com/accounts/ui/avatar_2x.png');
    }
  }, {
    key: 'render',
    value: function render() {
      var _this2 = this;

      var authors = this.props.authors;

      var authorRows = _lodash2.default.map(authors, function (author) {
        return _react2.default.createElement(
          'div',
          { key: author.id, className: 'row ' + _BottomAuthor2.default.authorRow },
          _react2.default.createElement(
            'div',
            { className: 'col-sm-2' },
            _react2.default.createElement('img', { src: _this2.getAvatar(author), className: 'img-responsive img-circle center-block' })
          ),
          _react2.default.createElement(
            'div',
            { className: 'col-sm-10' },
            _react2.default.createElement(
              'p',
              null,
              '|',
              _react2.default.createElement(
                'span',
                { className: _BottomAuthor2.default.authorName },
                author.name
              ),
              '|'
            ),
            author.bio && author.bio.html ? _react2.default.createElement('span', { className: _BottomAuthor2.default.bioText, dangerouslySetInnerHTML: _this2.setHtml(author.bio.html) }) : null,
            author.email ? _react2.default.createElement(
              'span',
              null,
              '(',
              author.email,
              ')'
            ) : null
          )
        );
      });

      return _react2.default.createElement(
        'div',
        { className: _BottomAuthor2.default.bottomAuthor },
        authorRows
      );
    }
  }]);

  return BottomAuthor;
}(_react.Component);