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

import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';

import logo from '../../../assets/images/stateseal.png';
import FooterLinks from '../../molecules/FooterLinks';
import SocialLinks from '../../molecules/SocialLinks';
import Icon from '../../base/Icon';

import './style.css';

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 React.createElement(
    'footer',
    { className: 'ma__footer js-footer', id: 'footer' },
    React.createElement(
      'div',
      { className: 'ma__footer__container' },
      React.createElement(
        'section',
        { className: 'ma__footer__info' },
        React.createElement(
          'div',
          { className: 'ma__footer__logo' },
          React.createElement(
            'a',
            { href: footerLogo.domain, title: footerLogo.title },
            React.createElement('img', { src: footerLogo.src, alt: '', width: '100', height: '100' })
          )
        ),
        React.createElement(
          'div',
          { className: 'ma__footer__social' },
          React.createElement(SocialLinks, socialLinks)
        ),
        React.createElement(
          'div',
          { className: 'ma__footer__copyright' },
          React.createElement(
            'p',
            { className: 'ma__footer__copyright--date' },
            '\xA9 ',
            footerText.copyright
          ),
          React.createElement(
            'p',
            null,
            footerText.description
          ),
          React.createElement(
            'a',
            { href: footerText.privacyPolicy.url },
            footerText.privacyPolicy.text
          )
        )
      ),
      React.createElement(
        'div',
        { className: 'ma__footer__nav' },
        React.createElement(FooterLinks, _extends({}, footerLinks, { showNavHeading: showNavHeading }))
      )
    ),
    backToTopButton && React.createElement(
      'button',
      { className: 'ma__footer__back2top js-back2top is-hidden' },
      React.createElement(Icon, { name: 'arrow' }),
      React.createElement(
        'span',
        { 'aria-hidden': 'true' },
        'Top'
      ),
      React.createElement(
        'span',
        { className: 'visually-hidden' },
        'Go to the top of the page'
      )
    )
  );
};

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

Footer.defaultProps = {
  showNavHeading: false,
  backToTopButton: false,
  footerLogo: {
    domain: '/',
    src: logo,
    title: 'Mass.gov homepage'
  },
  footerText: {
    copyright: moment().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'
    }
  }
};

export default Footer;