import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { ArrowButton } from '../../../index';
import './style.css';

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

  var sectionClasses = classNames((_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 React.createElement(
    Element,
    {
      className: sectionClasses,
      onClick: function onClick(e) {
        return onClickCallback(e);
      },
      href: props.href,
      title: props.info
    },
    React.createElement(ArrowButton, { direction: props.direction }),
    React.createElement(
      'h2',
      { className: 'ma__arrow-nav__title', 'data-label': props.label },
      React.createElement(
        'span',
        null,
        props.title
      )
    ),
    React.createElement(
      'div',
      { className: 'ma__arrow-nav__text' },
      props.text
    )
  );
};

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

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

export default ArrowNav;