'use strict';

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

var _templateObject = _taggedTemplateLiteral(['\n  display         : inline-block;\n  position        : relative;\n  padding         : 5px;\n  text-transform  : uppercase;\n  text-align      : center;\n  font-size       : 0.8rem;\n  line-height     : 0.8rem;\n  background-color: var(--px-alert-label-background-color--unknown, gray);\n  color           : var(--px-alert-label-text-color--unknown, white);\n  border          : 1px solid var(--px-alert-label-border-color, transparent);\n  \n  ', '\n  ', '\n  ', '\n  ', '\n  ', '\n  ', '\n  \n'], ['\n  display         : inline-block;\n  position        : relative;\n  padding         : 5px;\n  text-transform  : uppercase;\n  text-align      : center;\n  font-size       : 0.8rem;\n  line-height     : 0.8rem;\n  background-color: var(--px-alert-label-background-color--unknown, gray);\n  color           : var(--px-alert-label-text-color--unknown, white);\n  border          : 1px solid var(--px-alert-label-border-color, transparent);\n  \n  ', '\n  ', '\n  ', '\n  ', '\n  ', '\n  ', '\n  \n']),
    _templateObject2 = _taggedTemplateLiteral(['\n    background-color: var(--px-alert-label-background-color--information, blue);\n    color           : var(--px-alert-label-text-color--information, white);\n  '], ['\n    background-color: var(--px-alert-label-background-color--information, blue);\n    color           : var(--px-alert-label-text-color--information, white);\n  ']),
    _templateObject3 = _taggedTemplateLiteral(['\n    background-color: var(--px-alert-label-background-color--error, yellow);\n    color           : var(--px-alert-label-text-color--error, black);\n  '], ['\n    background-color: var(--px-alert-label-background-color--error, yellow);\n    color           : var(--px-alert-label-text-color--error, black);\n  ']),
    _templateObject4 = _taggedTemplateLiteral(['\n    background-color: var(--px-alert-label-background-color--unknown, gray);\n    color           : var(--px-alert-label-text-color--unknown, white);\n  '], ['\n    background-color: var(--px-alert-label-background-color--unknown, gray);\n    color           : var(--px-alert-label-text-color--unknown, white);\n  ']),
    _templateObject5 = _taggedTemplateLiteral(['\n    background-color: var(--px-alert-label-background-color--important, red);\n    color           : var(--px-alert-label-text-color--important, white);\n  '], ['\n    background-color: var(--px-alert-label-background-color--important, red);\n    color           : var(--px-alert-label-text-color--important, white);\n  ']),
    _templateObject6 = _taggedTemplateLiteral(['\n    background-color: var(--px-alert-label-background-color--warning, orange);\n    color           : var(--px-alert-label-text-color--warning, white);\n  '], ['\n    background-color: var(--px-alert-label-background-color--warning, orange);\n    color           : var(--px-alert-label-text-color--warning, white);\n  ']),
    _templateObject7 = _taggedTemplateLiteral(['\n    background-color: var(--px-alert-label-background-color--healthy, green);\n    color           : var(--px-alert-label-text-color--healthy, white);\n  '], ['\n    background-color: var(--px-alert-label-background-color--healthy, green);\n    color           : var(--px-alert-label-text-color--healthy, white);\n  ']);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

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

var _styledComponents2 = _interopRequireDefault(_styledComponents);

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

function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

var AlertLabel = _styledComponents2.default.div(_templateObject, function (props) {
  return props.type === 'info' && (0, _styledComponents.css)(_templateObject2);
}, function (props) {
  return props.type === 'error' && (0, _styledComponents.css)(_templateObject3);
}, function (props) {
  return props.type === 'unknown' && (0, _styledComponents.css)(_templateObject4);
}, function (props) {
  return props.type === 'important' && (0, _styledComponents.css)(_templateObject5);
}, function (props) {
  return props.type === 'warning' && (0, _styledComponents.css)(_templateObject6);
}, function (props) {
  return props.type === 'healthy' && (0, _styledComponents.css)(_templateObject7);
});

var _isCircle = function _isCircle(t) {
  return t === 'unknown';
};

var _getPoints = function _getPoints(t) {
  if (t === 'important') {
    return '16.5,3 32,30 1,30';
  } else if (t === 'warning') {
    return '16,0.5 32.5,16 16,32.5, 0.5,16';
  } else if (t === 'info' || t === 'information') {
    return '6.6,32.5 26.4,32.5 32.5,13 16,0.5 0.5,13';
  } else {
    return '3,3 3,30 30,30 30,3';
  }
};

exports.default = function (_ref) {
  var label = _ref.label,
      type = _ref.type,
      badge = _ref.badge,
      children = _ref.children;

  var classNames = (0, _classnames2.default)('alertlabel', type, badge);
  return _react2.default.createElement(
    AlertLabel,
    { type: type },
    _react2.default.createElement(
      'span',
      { className: classNames },
      badge && _react2.default.createElement(
        'div',
        null,
        !_isCircle(type) && _react2.default.createElement(
          'svg',
          { className: 'svg-canvas', viewBox: '0 0 33 33' },
          _react2.default.createElement('polygon', { id: 'polygon', points: _getPoints(type) })
        ),
        _isCircle(type) && _react2.default.createElement(
          'svg',
          { className: 'svg-canvas', viewBox: '0 0 33 33' },
          _react2.default.createElement('circle', { id: 'circle', cx: '16', cy: '16', r: '15' })
        )
      ),
      _react2.default.createElement(
        'div',
        { className: 'label' },
        _react2.default.createElement(
          'span',
          { className: 'label__text' },
          label
        )
      )
    )
  );
};