var _ref;

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; };

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import { mapToCssModules, omit, pick, TransitionPropTypeKeys, TransitionTimeouts, tagPropType } from './Shared/helper.js';
//
import CCard from './CCard';
//import CProgress from './CProgress';
import CCardBody from './CCardBody';
//import CCardHeader from './CCardHeader';
import CCardFooter from './CCardFooter';

//component - CoreUI / CWidgetIcon

var CWidgetIcon = function CWidgetIcon(props) {
  var children = props.children,
      className = props.className,
      cssModule = props.cssModule,
      header = props.header,
      mainText = props.mainText,
      icon = props.icon,
      color = props.color,
      footer = props.footer,
      link = props.link,
      variant = props.variant,
      attributes = _objectWithoutProperties(props, ['children', 'className', 'cssModule', 'header', 'mainText', 'icon', 'color', 'footer', 'link', 'variant']);

  var padding = variant === '0' ? { card: 'p-3', icon: 'p-3' } : variant === '1' ? {
    card: 'p-0', icon: 'p-4', lead: 'pt-3'
  } : { card: 'p-0', icon: 'p-4 px-5', lead: 'pt-3' };

  var card = { style: 'd-flex', color: color, icon: icon, classes: '' };
  card.classes = mapToCssModules(classNames(className, card.style, padding.card, 'align-items-center'), cssModule);

  var lead = { style: 'text-value', color: color, classes: '' };
  lead.classes = classNames(lead.style, 'text-' + card.color);

  var blockIcon = function blockIcon(icon) {
    var classes = classNames(icon, 'bg-' + card.color, padding.icon, 'font-2xl mr-3 float-left');
    return React.createElement('i', { className: classes });
  };

  var cardFooter = function cardFooter() {
    if (footer) {
      return React.createElement(
        CCardFooter,
        { className: 'px-3 py-2' },
        React.createElement(
          'a',
          { className: 'align-items-center btn-block d-flex justify-content-between text-muted', href: link },
          React.createElement(
            'span',
            { className: 'small font-weight-bold' },
            'View More'
          ),
          React.createElement('i', { className: 'fa fa-angle-right float-right font-lg' })
        )
      );
    }
  };

  return React.createElement(
    CCard,
    _extends({}, attributes, { custom: true }),
    React.createElement(
      CCardBody,
      _extends({ className: card.classes }, attributes),
      React.createElement(
        'div',
        null,
        blockIcon(card.icon)
      ),
      React.createElement(
        'div',
        null,
        React.createElement(
          'div',
          { className: lead.classes },
          header
        ),
        React.createElement(
          'div',
          { className: 'text-muted text-uppercase font-weight-bold small' },
          mainText
        )
      )
    ),
    cardFooter()
  );
};

CWidgetIcon.propTypes = process.env.NODE_ENV !== "production" ? (_ref = {
  children: PropTypes.node,
  className: PropTypes.string,
  cssModule: PropTypes.object,
  //
  innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  header: PropTypes.string,
  mainText: PropTypes.string,
  icon: PropTypes.string,
  color: PropTypes.string,
  variant: PropTypes.string,
  footer: PropTypes.bool,
  link: PropTypes.string
}, _ref['children'] = PropTypes.node, _ref) : {};

CWidgetIcon.defaultProps = {
  header: '$1,999.50',
  mainText: 'Widget title',
  icon: 'fa fa-cogs',
  color: 'primary',
  variant: '0',
  link: '#'
};

export default CWidgetIcon;