'use strict';

exports.__esModule = true;

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _moment = require('moment');

var _moment2 = _interopRequireDefault(_moment);

var _stateseal = require('../../../assets/images/stateseal.png');

var _stateseal2 = _interopRequireDefault(_stateseal);

var _FooterLinks = require('../../molecules/FooterLinks');

var _FooterLinks2 = _interopRequireDefault(_FooterLinks);

var _SocialLinks = require('../../molecules/SocialLinks');

var _SocialLinks2 = _interopRequireDefault(_SocialLinks);

var _Icon = require('../../base/Icon');

var _Icon2 = _interopRequireDefault(_Icon);

require('./style.css');

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

var Footer = function Footer(_ref) {
  var footerLinks = _ref.footerLinks,
      socialLinks = _ref.socialLinks,
      backToTopButton = _ref.backToTopButton,
      footerText = _ref.footerText,
      footerLogo = _ref.footerLogo,
      showNavHeading = _ref.showNavHeading;
  return _react2.default.createElement(
    'footer',
    { className: 'ma__footer js-footer', id: 'footer' },
    _react2.default.createElement(
      'div',
      { className: 'ma__footer__container' },
      _react2.default.createElement(
        'section',
        { className: 'ma__footer__info' },
        _react2.default.createElement(
          'div',
          { className: 'ma__footer__logo' },
          _react2.default.createElement(
            'a',
            { href: footerLogo.domain, title: footerLogo.title },
            _react2.default.createElement('img', { src: footerLogo.src, alt: '', width: '100', height: '100' })
          )
        ),
        _react2.default.createElement(
          'div',
          { className: 'ma__footer__social' },
          _react2.default.createElement(_SocialLinks2.default, socialLinks)
        ),
        _react2.default.createElement(
          'div',
          { className: 'ma__footer__copyright' },
          _react2.default.createElement(
            'p',
            { className: 'ma__footer__copyright--date' },
            '\xA9 ',
            footerText.copyright
          ),
          _react2.default.createElement(
            'p',
            null,
            footerText.description
          ),
          _react2.default.createElement(
            'a',
            { href: footerText.privacyPolicy.url },
            footerText.privacyPolicy.text
          )
        )
      ),
      _react2.default.createElement(
        'div',
        { className: 'ma__footer__nav' },
        _react2.default.createElement(_FooterLinks2.default, _extends({}, footerLinks, { showNavHeading: showNavHeading }))
      )
    ),
    backToTopButton && _react2.default.createElement(
      'button',
      { className: 'ma__footer__back2top js-back2top is-hidden' },
      _react2.default.createElement(_Icon2.default, { name: 'arrow' }),
      _react2.default.createElement(
        'span',
        { 'aria-hidden': 'true' },
        'Top'
      ),
      _react2.default.createElement(
        'span',
        { className: 'visually-hidden' },
        'Go to the top of the page'
      )
    )
  );
};

Footer.propTypes = process.env.NODE_ENV !== "production" ? {
  /** @molecules/FooterLinks */
  footerLinks: _propTypes2.default.shape(_FooterLinks2.default.propTypes).isRequired,
  /** Whether to display or visually hiding footer nav headings */
  showNavHeading: _propTypes2.default.bool,
  /** @molecules/SocialLinks */
  socialLinks: _propTypes2.default.shape(_SocialLinks2.default.propTypes).isRequired,
  /** A floating button on the lower right corner which onClick takes user to the top of the page. */
  backToTopButton: _propTypes2.default.bool,
  /** Adds footer logo */
  footerLogo: _propTypes2.default.shape({
    /** logo image source url */
    src: _propTypes2.default.string,
    /** The URL for the site root */
    domain: _propTypes2.default.string,
    /** The title of the logo link */
    title: _propTypes2.default.string
  }),
  /** Adds footer info section */
  footerText: _propTypes2.default.shape({
    /** Bolded copyright info starting with © */
    copyright: _propTypes2.default.string,
    /** Descriptive info below copyright */
    description: _propTypes2.default.string,
    /** A link to the privacy policy page of the site */
    privacyPolicy: _propTypes2.default.shape({
      text: _propTypes2.default.string,
      url: _propTypes2.default.string
    })
  })
} : {};

Footer.defaultProps = {
  showNavHeading: false,
  backToTopButton: false,
  footerLogo: {
    domain: '/',
    src: _stateseal2.default,
    title: 'Mass.gov homepage'
  },
  footerText: {
    copyright: (0, _moment2.default)().year() + ' Commonwealth of Massachusetts.',
    description: 'Mass.gov® is a registered service mark of the Commonwealth of Massachusetts.',
    privacyPolicy: {
      text: 'Mass.gov Privacy Policy',
      url: 'https://www.mass.gov/privacypolicy'
    }
  }
};

exports.default = Footer;
module.exports = exports['default'];