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

var _Icon2 = _interopRequireDefault(_Icon);

require('./style.css');

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

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

  var calloutAlertClasses = (0, _classnames2.default)((_classNames = {
    'ma__callout-alert': true
  }, _classNames['ma__callout-alert--' + props.theme] = props.theme, _classNames));

  var calloutAlertContentClasses = (0, _classnames2.default)({
    'ma__callout-alert__content': true,
    'ma__callout-alert__content--no-icon': !(props.icon && props.icon.name)
  });

  return _react2.default.createElement(
    'div',
    { className: calloutAlertClasses },
    _react2.default.createElement(
      'div',
      { className: calloutAlertContentClasses },
      props.icon && _react2.default.createElement(
        'div',
        { className: 'ma__callout-alert__icon' },
        _react2.default.createElement(_Icon2.default, props.icon)
      ),
      props.children
    )
  );
};

CalloutAlert.propTypes = process.env.NODE_ENV !== "production" ? {
  icon: _propTypes2.default.shape(_Icon2.default.propTypes),
  /** Themes correspond to site color scheme i.e. sass variables */
  theme: _propTypes2.default.oneOf(['', 'c-primary', 'c-primary-alt', 'c-highlight', 'c-gray-dark', 'c-error-red']),
  children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.array])
} : {};

CalloutAlert.defaultProps = {
  icon: { name: 'alert' }
};

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