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

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

var _lodash = require('lodash');

var _lodash2 = _interopRequireDefault(_lodash);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _Common = {
  "inner-block": "Common__inner-block___2cOrF",
  "disable-inner-block": "Common__disable-inner-block___1MLd0",
  "components": "Common__components___2fQuj",
  "component": "Common__component___3bwMg",
  "hide": "Common__hide___2HyoH",
  "desc-text-color": "Common__desc-text-color___2fV3l",
  "desc-text-block": "Common__desc-text-block___1Z4b-",
  "text-link": "Common__text-link___1jaLy",
  "image": "Common__image___AKB6W",
  "imagediff": "Common__imagediff___2j7tX",
  "slideshow": "Common__slideshow___1Fz23",
  "embeddedcode": "Common__embeddedcode___3Avmp",
  "youtube": "Common__youtube___2oq1n",
  "topic-box": "Common__topic-box___2Q-kN"
};

var _Common2 = _interopRequireDefault(_Common);

var _Introduction = {
  "intro-container": "Introduction__intro-container___3nFuZ"
};

var _Introduction2 = _interopRequireDefault(_Introduction);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var Introduction = exports.Introduction = function Introduction(_ref) {
  var data = _ref.data;

  var content = void 0;
  var block = false;
  var introArr = [];

  if (Array.isArray(data)) {
    content = data.map(function (ele, idx) {
      var element = _lodash2.default.get(ele, ['content', 0]);
      if (element.length > 0) {
        block = true;
        var paragraph = _lodash2.default.get(ele, ['content', 0]);
        introArr.push(_react2.default.createElement('p', { key: ele.id || idx, dangerouslySetInnerHTML: { __html: paragraph } }));
        return paragraph;
      }
    });
  } else {
    if (content.length > 0) {
      block = true;
      content = "<p>{_.get(data, [ 'content', 0 ])}</p>";
      introArr.push(_react2.default.createElement('div', { dangerouslySetInnerHTML: { __html: content } }));
    }
  }

  if (block) {
    return _react2.default.createElement(
      'div',
      { className: (0, _classnames2.default)(_Introduction2.default['intro-container'], 'text-justify') },
      introArr
    );
  } else {
    return _react2.default.createElement('div', null);
  }
};