'use strict';

exports.__esModule = true;

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

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 _is = require('is');

var _is2 = _interopRequireDefault(_is);

var _airbnbPropTypes = require('airbnb-prop-types');

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

var _Icon2 = _interopRequireDefault(_Icon);

require('./style.css');

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

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

  var title = props.title,
      icon = props.icon,
      prefix = props.prefix,
      theme = props.theme;

  var linkArgs = {
    theme: theme,
    linkClasses: 'ma__content-link'
  };
  var h2Classes = (0, _classnames2.default)((_classNames = {
    'ma__emergency-header': true
  }, _classNames['ma__emergency-header--' + theme] = theme, _classNames));
  return _react2.default.createElement(
    'h2',
    { className: h2Classes },
    (icon || prefix) && _react2.default.createElement(
      'span',
      { className: 'ma__emergency-header__label' },
      icon,
      _react2.default.createElement(
        'span',
        null,
        prefix
      )
    ),
    _react2.default.createElement(
      'span',
      { className: 'ma__emergency-header__title' },
      _is2.default.fn(title) ? title(_extends({}, linkArgs)) : title
    )
  );
};

EmergencyHeader.propTypes = process.env.NODE_ENV !== "production" ? {
  /** A function whose return value is displayed in the text to the right of the divider bar. */
  title: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.string]).isRequired,
  /** A string that controls different color themes for the component. */
  theme: _propTypes2.default.oneOf(['c-warning', 'c-primary-alt', 'c-primary', 'c-gray', 'c-error']),
  /** A SVG icon to display to the left of the prefix text. */
  icon: (0, _airbnbPropTypes.componentWithName)('Icon'),
  /** An optional string displayed to the left of the divider bar. */
  prefix: _propTypes2.default.string
} : {};
EmergencyHeader.defaultProps = {
  theme: 'c-warning',
  prefix: 'Emergency Alerts',
  icon: _react2.default.createElement(_Icon2.default, { name: 'alert' })
};

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