'use strict';

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

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 _templateObject = _taggedTemplateLiteral(['\n    :root {\n        --textBlack: #030E26;\n        --shark: #24292E;\n        --porcelain: #F4F6F7;\n        --silver: #cecece;\n        --whiteAlpha75: rgba(255,255,255,0.75);\n        --whiteAlpha10: rgba(255,255,255,0.1);\n        --blackAlpha75: rgba(0,0,0,0.75);\n        --blackAlpha05: rgba(0,0,0,0.05);\n\n        /* blues */\n        --cerulean: #10ADE4;\n        --azure: #3558A8;\n        --biscay: #222D38;\n        --orient: #004A7C;\n        --powderBlue: #B2D5E5;\n        --blueWood: #27324B;\n\n        --siteMaxWidth: 75rem;\n        --contentMaxWidth: 62rem;\n        --copyMaxWidth: 42rem;\n\n        --smScreen: 48rem;\n        --mdScreen: 62rem;\n        --lgScreen: 75rem;\n\n        --smBorderRadius: 2px;\n        --lgBorderRadius: 4px;\n    }\n'], ['\n    :root {\n        --textBlack: #030E26;\n        --shark: #24292E;\n        --porcelain: #F4F6F7;\n        --silver: #cecece;\n        --whiteAlpha75: rgba(255,255,255,0.75);\n        --whiteAlpha10: rgba(255,255,255,0.1);\n        --blackAlpha75: rgba(0,0,0,0.75);\n        --blackAlpha05: rgba(0,0,0,0.05);\n\n        /* blues */\n        --cerulean: #10ADE4;\n        --azure: #3558A8;\n        --biscay: #222D38;\n        --orient: #004A7C;\n        --powderBlue: #B2D5E5;\n        --blueWood: #27324B;\n\n        --siteMaxWidth: 75rem;\n        --contentMaxWidth: 62rem;\n        --copyMaxWidth: 42rem;\n\n        --smScreen: 48rem;\n        --mdScreen: 62rem;\n        --lgScreen: 75rem;\n\n        --smBorderRadius: 2px;\n        --lgBorderRadius: 4px;\n    }\n']);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _styledComponents = require('styled-components');

var _styledComponents2 = _interopRequireDefault(_styledComponents);

var _universalCookie = require('universal-cookie');

var _universalCookie2 = _interopRequireDefault(_universalCookie);

var _Images = require('../Images');

var _Select = require('./Select');

var _Normalize = require('../Normalize.js');

var _Normalize2 = _interopRequireDefault(_Normalize);

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

function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

(0, _styledComponents.injectGlobal)(_templateObject);

var GlobalFooter = _styledComponents2.default.div.withConfig({
  displayName: 'Footer__GlobalFooter'
})(['', ' background:var(--porcelain);position:relative;padding-top:4rem;padding-bottom:4rem;@media only screen and (max-width:48rem){padding-top:2rem;padding-bottom:2rem;}'], _Normalize2.default);

var Container = _styledComponents2.default.div.attrs({
  className: 'flex-container'
}).withConfig({
  displayName: 'Footer__Container'
})(['flex-direction:column;max-width:var(--siteMaxWidth);padding:1.25rem 2rem;color:var(--textBlack);margin:0 auto;a{transition:color .5s,opacity:.5s;font-weight:500;}a:hover{color:var(--azure);opacity:1;}h5{text-transform:uppercase;font-size:0.875rem;font-weight:600;margin-bottom:0.5rem;}']);

var SiteNav = _styledComponents2.default.div.withConfig({
  displayName: 'Footer__SiteNav'
})(['display:flex;flex-direction:row;flex-wrap:nowrap;& a{opacity:0.75;}@media only screen and (max-width:62em){flex-wrap:wrap;}']);

var LangNav = _styledComponents2.default.div.withConfig({
  displayName: 'Footer__LangNav'
})(['display:flex;flex-direction:row;justify-content:space-between;flex-wrap:wrap;align-items:center;@media only screen and (max-width:62em){flex-direction:column;align-items:flex-start;}']);

var Column = _styledComponents2.default.div.withConfig({
  displayName: 'Footer__Column'
})(['flex:0 1 auto;margin-bottom:4rem;line-height:2.5rem;margin-right:2rem;width:12rem;&:last-child{margin-right:0;}h5{margin-bottom:1rem;}li{display:block;word-wrap:break-word;margin-bottom:1.25rem;line-height:1.4;}@media only screen and (max-width:48rem){margin-bottom:2rem;}']);

var NavBadge = _styledComponents2.default.span.withConfig({
  displayName: 'Footer__NavBadge'
})(['color:white;background-color:var(--cerulean);padding:0.25rem;margin-left:0.75rem;font-size:0.625rem;text-transform:uppercase;font-weight:700;border-radius:var(--smBorderRadius);']);

var Copyright = _styledComponents2.default.p.withConfig({
  displayName: 'Footer__Copyright'
})(['font-size:0.75rem;font-weight:500;opacity:0.4;text-align:right;clear:both;line-height:1.2rem;@media only screen and (max-width:62em){text-align:left;}']);

var SocialLinksWrap = _styledComponents2.default.div.withConfig({
  displayName: 'Footer__SocialLinksWrap'
})(['display:flex;flex-direction:row;']);

var SocialLinks = _styledComponents2.default.a.attrs({
  target: '_blank'
}).withConfig({
  displayName: 'Footer__SocialLinks'
})(['display:flex;height:2.5rem;width:2.5rem;border-radius:100%;background-color:var(--silver) !important;color:white;transition:all 0.5s;margin-right:0.75rem;justify-content:center;.social-icons{opacity:0.5;}&:hover{background:var(--azure) !important;.social-icons{opacity:1;}}@media only screen and (max-width:48rem){height:2rem;width:2rem;margin-top:2rem;img{padding:0.5rem;}}']);

var BlueLogo = (0, _styledComponents2.default)(_Images.Image).withConfig({
  displayName: 'Footer__BlueLogo'
})(['float:right;margin-bottom:20px;']);

var supportedLanguages = {
  'da': 'Danish',
  'de': 'German',
  'en': 'English',
  'es': 'Spanish',
  'fr': 'French'
};

var langItems = Object.keys(supportedLanguages).map(function (langKey) {
  return {
    text: supportedLanguages[langKey],
    value: langKey
  };
});

var Footer = function (_PureComponent) {
  _inherits(Footer, _PureComponent);

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

    var _this = _possibleConstructorReturn(this, (Footer.__proto__ || Object.getPrototypeOf(Footer)).call(this, props));

    _this.cookies = new _universalCookie2.default();

    _this.lang = _this.cookies.get('clang') || 'en';

    var langPathMatch = window.location.pathname.match(/^\/([a-z]{2})\//);
    var langPath = langPathMatch && langPathMatch[1];
    if (langPath && langPath in supportedLanguages) {
      _this.lang = langPath;
    }

    _this.handleDropdown = _this.handleDropdown.bind(_this);
    return _this;
  }

  _createClass(Footer, [{
    key: 'handleDropdown',
    value: function handleDropdown(value) {
      var toLocation = window.location;
      var pathname = window.location.pathname;
      var langPathMatch = pathname.match(/^\/([a-z]{2})\/(.*)/);
      if (langPathMatch && langPathMatch[1] in supportedLanguages) {
        toLocation = '/' + value + '/' + langPathMatch[2];
      } else {
        toLocation = '/' + value + pathname;
      }
      window.setTimeout(function () {
        // trigger page refresh
        window.location.href = toLocation;
      }, 1);
    }
  }, {
    key: 'render',
    value: function render() {
      var base = this.props.base;

      base = base || 'https://blockchain.com';

      return _react2.default.createElement(
        GlobalFooter,
        null,
        _react2.default.createElement(
          Container,
          null,
          _react2.default.createElement(
            SiteNav,
            null,
            _react2.default.createElement(
              Column,
              null,
              _react2.default.createElement(
                'h5',
                null,
                'Products'
              ),
              _react2.default.createElement(
                'ul',
                null,
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/wallet' },
                    'Wallet'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/explorer' },
                    'Explorer'
                  ),
                  _react2.default.createElement(
                    NavBadge,
                    null,
                    'Info'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: 'https://bps.blockchain.com/' },
                    'Principal Strategies'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/api' },
                    'Developers'
                  )
                )
              )
            ),
            _react2.default.createElement(
              Column,
              null,
              _react2.default.createElement(
                'h5',
                null,
                'Data'
              ),
              _react2.default.createElement(
                'ul',
                null,
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/markets' },
                    'Markets'
                  ),
                  _react2.default.createElement(
                    NavBadge,
                    null,
                    'New'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/charts' },
                    'Charts'
                  )
                )
              )
            ),
            _react2.default.createElement(
              Column,
              null,
              _react2.default.createElement(
                'h5',
                null,
                'Learn'
              ),
              _react2.default.createElement(
                'ul',
                null,
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/learning-portal/bitcoin-faq' },
                    'What is Bitcoin'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/learning-portal/ether-basics' },
                    'What is Ethereum'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/learning-portal' },
                    'Getting Started'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: 'https://blog.blockchain.com' },
                    'Blog'
                  )
                )
              )
            ),
            _react2.default.createElement(
              Column,
              null,
              _react2.default.createElement(
                'h5',
                null,
                'Company'
              ),
              _react2.default.createElement(
                'ul',
                null,
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/about' },
                    'About'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/team' },
                    'Team'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/careers' },
                    'Careers'
                  ),
                  _react2.default.createElement(
                    NavBadge,
                    null,
                    'Hiring'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/legal' },
                    'Legal'
                  )
                )
              )
            ),
            _react2.default.createElement(
              Column,
              null,
              _react2.default.createElement(
                'h5',
                null,
                'Contact Us'
              ),
              _react2.default.createElement(
                'ul',
                null,
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: base + '/press' },
                    'Press'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: 'https://support.blockchain.com' },
                    'Support'
                  )
                ),
                _react2.default.createElement(
                  'li',
                  null,
                  _react2.default.createElement(
                    'a',
                    { href: 'https://www.blockchain-status.com/' },
                    'Status'
                  )
                )
              )
            ),
            _react2.default.createElement(
              Column,
              null,
              _react2.default.createElement(BlueLogo, { name: 'blue-logo', height: '50px' }),
              _react2.default.createElement(
                Copyright,
                null,
                '\xA9 ',
                new Date().getFullYear(),
                ' BLOCKCHAIN LUXEMBOURG S.A.'
              )
            )
          ),
          _react2.default.createElement(
            LangNav,
            null,
            _react2.default.createElement(_Select.Select, { transparent: true,
              items: langItems,
              value: this.lang,
              onChange: this.handleDropdown
            }),
            _react2.default.createElement(
              SocialLinksWrap,
              null,
              _react2.default.createElement(
                SocialLinks,
                { href: 'https://twitter.com/blockchain' },
                _react2.default.createElement(_Images.Image, { name: 'twitter-white' })
              ),
              _react2.default.createElement(
                SocialLinks,
                { href: 'https://www.linkedin.com/company/blockchain/' },
                _react2.default.createElement(_Images.Image, { name: 'linkedin-white' })
              ),
              _react2.default.createElement(
                SocialLinks,
                { href: 'https://www.facebook.com/blockchain/' },
                _react2.default.createElement(_Images.Image, { name: 'facebook-white' })
              )
            )
          )
        )
      );
    }
  }]);

  return Footer;
}(_react.PureComponent);

exports.default = Footer;