'use strict';

exports.__esModule = true;

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 _Icon = require('../../base/Icon');

var _Icon2 = _interopRequireDefault(_Icon);

require('./style.css');

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

var FooterSlim = function FooterSlim(props) {
  return _react2.default.createElement(
    'footer',
    { className: 'ma__footer_slim', id: 'footer' },
    _react2.default.createElement(
      'div',
      { className: 'ma__footer_slim--container ma__container' },
      props.siteLogo,
      _react2.default.createElement(
        'div',
        { className: 'ma__footer_slim--container-inner' },
        _react2.default.createElement(
          'section',
          { className: 'ma__footer_slim--info' },
          _react2.default.createElement(
            'h3',
            null,
            props.title
          ),
          _react2.default.createElement(
            'p',
            null,
            props.description
          ),
          _react2.default.createElement(
            'p',
            { className: 'ma__footer_slim--copyright' },
            '\xA9 ',
            (0, _moment2.default)().year(),
            ' Commonwealth of Massachusetts'
          )
        ),
        _react2.default.createElement(
          'section',
          { className: 'ma__footer_slim--details' },
          props.links && _react2.default.createElement(
            'div',
            { className: 'ma__footer_slim--links' },
            props.links.map(function (link, linkIndex) {
              return (
                /* eslint-disable-next-line react/no-array-index-key */
                _react2.default.createElement(
                  'a',
                  { href: link.href, key: 'footslimlinks-' + linkIndex },
                  link.title
                )
              );
            })
          ),
          props.contact && _react2.default.createElement(
            'div',
            { className: 'ma__footer_slim--contact' },
            props.contact.address && _react2.default.createElement(
              'p',
              null,
              _react2.default.createElement(_Icon2.default, { name: 'marker', svgWidth: 20, svgHeight: 20 }),
              _react2.default.createElement(
                'span',
                null,
                props.contact.address
              )
            ),
            props.contact.phone && _react2.default.createElement(
              'p',
              null,
              _react2.default.createElement(_Icon2.default, { name: 'phone', svgWidth: 20, svgHeight: 20 }),
              _react2.default.createElement(
                'span',
                null,
                props.contact.phone
              )
            ),
            props.contact.online && props.contact.online.href && props.contact.online.title && _react2.default.createElement(
              'p',
              null,
              _react2.default.createElement(_Icon2.default, { name: 'laptop', svgWidth: 20, svgHeight: 20 }),
              _react2.default.createElement(
                'a',
                { href: props.contact.online.href },
                props.contact.online.title
              )
            )
          )
        )
      )
    )
  );
};

FooterSlim.propTypes = process.env.NODE_ENV !== "production" ? {
  /** The main title to be displayed in the footer */
  title: _propTypes2.default.string.isRequired,
  /** A short description */
  description: _propTypes2.default.string.isRequired,
  /** Additional links for key information */
  links: _propTypes2.default.arrayOf(_propTypes2.default.shape({
    href: _propTypes2.default.string,
    title: _propTypes2.default.string
  })),
  /** Contact details for the responsible authority */
  contact: _propTypes2.default.shape({
    address: _propTypes2.default.string,
    phone: _propTypes2.default.string,
    online: _propTypes2.default.shape({
      href: _propTypes2.default.string,
      title: _propTypes2.default.string
    })
  }),
  /** The domain you want to send users to from the site logo icon */
  // eslint-disable-next-line consistent-return
  siteLogo: function siteLogo(props, propName, componentName) {
    var component = props[propName];
    var isValid = function isValid(comp) {
      if (typeof comp.type === 'string') {
        return comp.type === 'SiteLogo';
      }
      return comp.type.name && comp.type.name === 'SiteLogo';
    };
    if (!component || component && !isValid(component)) {
      return new Error('Invalid prop ' + propName + ' supplied to ' + componentName + '. Got: ' + component.type.name + '. Validation failed.');
    }
  }
} : {};

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