'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _styledComponents = require('styled-components');

var _styledComponents2 = _interopRequireDefault(_styledComponents);

var _icons = require('./helpers/icons');

var _icons2 = _interopRequireDefault(_icons);

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

var Alert = _styledComponents2.default.div.withConfig({
  displayName: 'Alert__Alert'
})(['display: inline-block;padding: 10px 15px;border-width: 1px;border-style: solid;font-weight: 500;width: auto;line-height: 1em;a {color: inherit;}a::after {background: ', ';}background: ', ';color: ', ';&::before {content: ', ';border-width: 1px;border-style: solid;border-color: ', ';background: ', ';width: 1.2em;height: 1.2em;display: inline-block;line-height: 1.2em;font-family: ', ';text-align: center;border-radius: 100%;font-size: 0.9em;margin-right: 1em;}'], function (_ref) {
  var theme = _ref.theme,
      type = _ref.type;

  switch (type) {
    case 'success':
      return theme.colors.successText;
    case 'error':
      return theme.colors.errorText;
    default:
      return theme.colors.infoText;
  }
}, function (_ref2) {
  var theme = _ref2.theme,
      type = _ref2.type;

  switch (type) {
    case 'success':
      return theme.colors.successBackgroundLight;
    case 'error':
      return theme.colors.errorBackgroundLight;
    default:
      return theme.colors.infoBackgroundLight;
  }
}, function (_ref3) {
  var theme = _ref3.theme,
      type = _ref3.type;

  switch (type) {
    case 'success':
      return theme.colors.successText;
    case 'error':
      return theme.colors.errorText;
    default:
      return theme.colors.infoText;
  }
}, function (_ref4) {
  var type = _ref4.type,
      textOnly = _ref4.textOnly;

  if (textOnly) {
    return '';
  }

  switch (type) {
    case 'success':
      return '"' + (0, _icons2.default)('checkmark') + '"';
    case 'error':
      return '"!"';
    default:
      return '"i"';
  }
}, function (_ref5) {
  var theme = _ref5.theme,
      type = _ref5.type;

  switch (type) {
    case 'success':
      return theme.colors.successBorder;
    case 'error':
      return theme.colors.errorBorder;
    default:
      return theme.colors.infoBorder;
  }
}, function (_ref6) {
  var theme = _ref6.theme;
  return theme.colors.white;
}, function (_ref7) {
  var theme = _ref7.theme;
  return 'Bandwidth, ' + theme.fonts.brand;
});

Alert.propTypes = {
  type: _propTypes2.default.oneOf(['info', 'success', 'error']),
  textOnly: _propTypes2.default.bool
};

Alert.defaultProps = {
  type: 'info',
  textOnly: false
};

Alert.usage = '\n# Alert\n\nAlerts control their own color based on `type`.\n\n* `type`: `[\'info\', \'success\', \'error\']`\n* `textOnly`: `true|false`\n';

exports.default = Alert;