'use strict';

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

var _index = require('../constants/index');

var _lodash = require('lodash');

var _lodash2 = _interopRequireDefault(_lodash);

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

if (process.env.BROWSER) {}

var FooterFull = function (_Component) {
  _inherits(FooterFull, _Component);

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

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

  _createClass(FooterFull, [{
    key: 'render',
    value: function render() {
      var _props = this.props;
      var pathName = _props.pathName;
      var sectionList = _props.sectionList;

      var currentSection = pathName.split('/')[2];
      var footerMenu = {};
      footerMenu.sections = [];
      footerMenu.categories = [];

      _lodash2.default.each(sectionList.sections, function (s) {
        if (s.isFeatured) {
          footerMenu.sections.push(s);
        }
        _lodash2.default.each(s.categories, function (c) {
          if (c.isFeatured) {
            footerMenu.categories.push(c);
          }
        });
      });

      return _react2.default.createElement(
        'footer',
        { className: 'section-footer section-footer--black' },
        _react2.default.createElement(
          _reactRouter.Link,
          { to: '/section/' + currentSection },
          _react2.default.createElement(
            'figure',
            { className: 'footer-logo' },
            _react2.default.createElement('img', { className: '', src: '/asset/icon/section-' + 'watch' + '_s.png' })
          )
        ),
        _react2.default.createElement(
          'div',
          { className: 'footer-menu' },
          _lodash2.default.map(footerMenu.sections, function (s) {
            return _react2.default.createElement(
              'div',
              { className: 'footer-menu__item', key: 'footer-' + s.name },
              _react2.default.createElement(
                _reactRouter.Link,
                { to: '/section/' + s.name },
                s.title
              )
            );
          }),
          _lodash2.default.map(footerMenu.categories, function (c) {
            return _react2.default.createElement(
              'div',
              { className: 'footer-menu__item', key: 'footer-' + c.name },
              _react2.default.createElement(
                _reactRouter.Link,
                { to: '/category/' + c.name },
                c.title
              )
            );
          })
        ),
        _react2.default.createElement('div', { className: 'footer-vertDivider' }),
        _react2.default.createElement(
          'div',
          { className: 'footer-subscrShare' },
          _react2.default.createElement(
            'div',
            { className: 'footer-subscrShare__subscribe' },
            _react2.default.createElement(
              'a',
              { href: _index.SOCIAL_LINK.SUBSCRIBE },
              '訂閱鏡週刊'
            ),
            ' - ',
            _react2.default.createElement(
              'a',
              { href: 'https://www.mirrormedia.mg/story/ad1018001/index.html?utm_source=mm&utm_medium=footer&utm_campaign=salesteam' },
              '廣告合作'
            )
          ),
          _react2.default.createElement('div', { className: 'footer-subscrShare__horizDivider' }),
          _react2.default.createElement(
            'div',
            { className: 'footer-subscrShare__share' },
            _react2.default.createElement(
              'a',
              { className: '', href: _index.SOCIAL_LINK.FACEBOOK },
              _react2.default.createElement('img', { src: '/asset/icon/facebook_white.png', className: 'footerFull-icon facebook' })
            ),
            _react2.default.createElement(
              'a',
              { className: '', href: _index.SOCIAL_LINK.LINE },
              _react2.default.createElement('img', { src: '/asset/icon/line_white.png', className: 'footerFull-icon line' })
            ),
            _react2.default.createElement(
              'a',
              { className: '', href: _index.SOCIAL_LINK.WEIBO },
              _react2.default.createElement('img', { src: '/asset/icon/weibo_white.png', className: 'footerFull-icon weibo' })
            )
          )
        )
      );
    }
  }]);

  return FooterFull;
}(_react.Component);

exports.default = FooterFull;
exports.FooterFull = FooterFull;