import React from 'react';
import PropTypes from 'prop-types';
import Icon from '../../base/Icon';
import './style.css';

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

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

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

export default CalloutLink;