import React from 'react';
import ProgressBar from '../progress-bar';
import StatusItem from '../../atom/status-item';
import { COLORS } from '../../variables/colors';
import style from './style.css';
import { propTypes } from './types';
const {
  negative: cm_negative_100,
  cm_primary_blue,
  cm_positive_500
} = COLORS;
const STATUS = {
  inProgress: 'inProgress',
  fail: 'fail'
};
const renderStatusIcon = (status, progress) => {
  if (status === STATUS.inProgress) return /*#__PURE__*/React.createElement("div", {
    role: "status",
    className: style.progressText
  }, `${progress} %`);
  return /*#__PURE__*/React.createElement("div", {
    className: style.statusItemWrapper
  }, /*#__PURE__*/React.createElement(StatusItem, {
    icon: status === STATUS.fail ? 'invalid' : 'valid'
  }));
};
const resolveProgressBarColor = status => {
  switch (status) {
    case STATUS.fail:
      return cm_negative_100;
    case STATUS.inProgress:
      return cm_primary_blue;
    default:
      return cm_positive_500;
  }
};
const BulkProgressBar = props => {
  const {
    'data-name': dataName,
    status,
    progress
  } = props;
  return /*#__PURE__*/React.createElement("div", {
    className: style.container,
    "data-name": dataName
  }, /*#__PURE__*/React.createElement(ProgressBar, {
    className: style.progressBar,
    value: progress,
    max: 100,
    steps: 0,
    style: {
      backgroundColor: resolveProgressBarColor(status),
      borderRadius: '10px'
    },
    displayInfo: false
  }), renderStatusIcon(status, progress));
};
BulkProgressBar.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
export default BulkProgressBar;
//# sourceMappingURL=index.js.map