'use strict';

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

var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');

var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);

var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n  &::before {\n    font-size: 14px;\n  }\n\n  ', ' > & {\n    margin: 0 5px auto 0;\n  }\n'], ['\n  &::before {\n    font-size: 14px;\n  }\n\n  ', ' > & {\n    margin: 0 5px auto 0;\n  }\n']);

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

var _styledComponents2 = _interopRequireDefault(_styledComponents);

var _themeGet = require('../../../extensions/themeGet');

var _themeGet2 = _interopRequireDefault(_themeGet);

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

var _icons2 = _interopRequireDefault(_icons);

var _AlertContent = require('./AlertContent');

var _AlertContent2 = _interopRequireDefault(_AlertContent);

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

var SIZE = exports.SIZE = '31px';
var SMALL_SIZE = '18px';

var getAlertIcon = function getAlertIcon(size) {
  return _styledComponents2.default.i.withConfig({
    displayName: 'AlertIcon'
  })(['width:', ';height:', ';display:inline-block;border-color:inherit;&::before{content:', ';box-sizing:border-box;border-width:', ';border-style:solid;border-color:inherit;background:', ';width:', ';height:', ';display:inline-block;line-height:', ';font-family:', ';font-weight:', ';border-color:', ';text-align:center;border-radius:100%;font-size:22px;position:absolute;font-style:normal;}'], size, size, function (_ref) {
    var type = _ref.type;

    switch (type) {
      case 'success':
        return '"' + (0, _icons2.default)('checkmark') + '"';
      case 'error':
        return '"!"';
      default:
        return '"i"';
    }
  }, (0, _themeGet2.default)('thicknesses.normal'), (0, _themeGet2.default)('colors.background.default'), size, size, size, function (props) {
    switch (props.type) {
      case 'success':
        return (0, _themeGet2.default)('fonts.icon');
      case 'error':
      default:
        return (0, _themeGet2.default)('fonts.brand');
    }
  }, function (props) {
    switch (props.type) {
      case 'success':
        return 'normal';
      default:
        return 500;
    }
  }, function (_ref2) {
    var theme = _ref2.theme,
        type = _ref2.type;

    switch (type) {
      case 'success':
        return (0, _themeGet2.default)('colors.positive.border');
      case 'error':
        return (0, _themeGet2.default)('colors.negative.border');
      default:
        return (0, _themeGet2.default)('colors.primary.border');
    }
  });
};

var AlertIcon = getAlertIcon(SIZE);
AlertIcon.Small = getAlertIcon(SMALL_SIZE).extend(_templateObject, _AlertContent2.default.Small);

exports.default = AlertIcon;