'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

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

require('./style.css');

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

var ArrowNav = function ArrowNav(props) {
  var _classNames;

  var sectionClasses = (0, _classnames2.default)((_classNames = {
    'js-clickable-link': true,
    'ma__arrow-nav': true
  }, _classNames['ma__arrow-nav--' + props.direction] = props.direction, _classNames));
  var Element = props.href ? 'a' : 'section';
  var onClickCallback = function onClickCallback(e) {
    if (typeof props.onClick === 'function') {
      e.preventDefault();
      props.onClick(e);
    }
  };
  return _react2.default.createElement(
    Element,
    {
      className: sectionClasses,
      onClick: function onClick(e) {
        return onClickCallback(e);
      },
      href: props.href,
      title: props.info
    },
    _react2.default.createElement(_index.ArrowButton, { direction: props.direction }),
    _react2.default.createElement(
      'h2',
      { className: 'ma__arrow-nav__title', 'data-label': props.label },
      _react2.default.createElement(
        'span',
        null,
        props.title
      )
    ),
    _react2.default.createElement(
      'div',
      { className: 'ma__arrow-nav__text' },
      props.text
    )
  );
};

ArrowNav.propTypes = process.env.NODE_ENV !== "production" ? {
  /** Top label information */
  label: _propTypes2.default.string.isRequired,
  /** Title */
  title: _propTypes2.default.string.isRequired,
  /** Link information */
  info: _propTypes2.default.string,
  /** Arrow Direction */
  direction: _propTypes2.default.oneOf(['left', 'right']),
  /** Link href */
  href: _propTypes2.default.string,
  /** Function */
  onClick: _propTypes2.default.func,
  /** Bottom Link text */
  text: _propTypes2.default.string
} : {};

ArrowNav.defaultProps = {
  info: '',
  href: '',
  onClick: '',
  text: '',
  direction: 'left'
};

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