'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

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

var _Icon2 = _interopRequireDefault(_Icon);

require('./style.css');

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

var CalloutLink = function CalloutLink(calloutLink) {
  var calloutLinkTheme = calloutLink.theme ? ' ma__callout-link--' + calloutLink.theme : '';
  var classNames = 'ma__callout-link' + calloutLinkTheme;

  return _react2.default.createElement(
    'div',
    { className: classNames, title: calloutLink.info },
    _react2.default.createElement(
      'a',
      { href: calloutLink.href },
      (calloutLink.eyebrow || calloutLink.time) && _react2.default.createElement(
        'div',
        { className: 'ma__callout-link__header' },
        _react2.default.createElement(
          'span',
          { className: 'ma__callout-link__eyebrow' },
          calloutLink.eyebrow
        ),
        _react2.default.createElement(
          'span',
          { className: 'ma__callout-link__time' },
          calloutLink.time
        )
      ),
      _react2.default.createElement(
        'span',
        { className: 'ma__callout-link__container' },
        _react2.default.createElement(
          'span',
          { className: 'ma__callout-link__text' },
          calloutLink.text,
          '\xA0',
          _react2.default.createElement(_Icon2.default, { name: 'arrow' })
        )
      ),
      calloutLink.emphasized && _react2.default.createElement(
        'span',
        { className: 'ma__callout-link__emphasized' },
        calloutLink.emphasized
      ),
      calloutLink.description && _react2.default.createElement(
        'p',
        { className: 'ma__callout-link__description' },
        calloutLink.description
      )
    )
  );
};

CalloutLink.propTypes = process.env.NODE_ENV !== "production" ? {
  /** The heading text  */
  text: _propTypes2.default.string.isRequired,
  /** The link the callout is going to */
  href: _propTypes2.default.string.isRequired,
  /** Add more information about the link */
  info: _propTypes2.default.string,
  /** Add description text under the title text */
  description: _propTypes2.default.string,
  /** Adds and eyebrow to the callout link */
  eyebrow: _propTypes2.default.string,
  /** Adds a time note to the top left of the card */
  time: _propTypes2.default.string,
  /** Adds emphasized text below the title link */
  emphasized: _propTypes2.default.string,
  /** Change the theme of the callout link, option are default (blue) and white */
  theme: _propTypes2.default.oneOf(['', 'white'])
} : {};

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