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

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

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _Video = {
  "video-container": "Video__video-container___1qpap",
  "mobile": "Video__mobile___3q3gv",
  "video-info-container": "Video__video-info-container___1tYhj",
  "html": "Video__html___8xv-v",
  "without-cp": "Video__without-cp___kXzJW",
  "progress-bt": "Video__progress-bt___3S1S4"
};

var _Video2 = _interopRequireDefault(_Video);

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return 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 Video = function (_React$Component) {
  _inherits(Video, _React$Component);

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

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

  _createClass(Video, [{
    key: 'componentWillUnmount',
    value: function componentWillUnmount() {}
  }, {
    key: 'render',
    value: function render() {
      var _props = this.props;
      var content = _props.content;
      var device = _props.device;

      var _$get = _lodash2.default.get(content, 0, {});

      var url = _$get.url;
      var coverPhoto = _$get.coverPhoto;
      var title = _$get.title;
      var description = _$get.description;


      return _react2.default.createElement(
        'div',
        { className: (0, _classnames2.default)(_Video2.default['video-container'], _defineProperty({}, _Video2.default['mobile'], device === 'mobile' ? true : false)) },
        _react2.default.createElement(
          'video',
          { style: { width: '100%' }, controls: true, ref: 'video' },
          _react2.default.createElement('source', { src: url })
        ),
        _react2.default.createElement(
          'div',
          { className: (0, _classnames2.default)(_Video2.default['video-info-container'], _Video2.default['without-cp']) },
          _react2.default.createElement(
            'div',
            { style: { display: 'inline-block' } },
            _react2.default.createElement(
              'h4',
              null,
              title
            )
          ),
          _react2.default.createElement('div', { className: _Video2.default['html'], dangerouslySetInnerHTML: { __html: description }, style: { marginTop: '16px' } })
        )
      );
    }
  }]);

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

Video.propTypes = {
  content: _react2.default.PropTypes.array.isRequired,
  device: _react2.default.PropTypes.string,
  styles: _react2.default.PropTypes.object
};

Video.defaultProps = {
  content: [],
  device: '',
  styles: {}
};

exports.Video = Video;