Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/ui / dist / components / molecules / MeterBar / renderProps.js
Size: Mime:
"use strict";

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

const tslib_1 = require("tslib");

const react_1 = tslib_1.__importDefault(require("react"));

const ProgressBar_1 = require("../../atoms/ProgressBar");

const deps_1 = require("./deps");

const styled_1 = require("./styled");
/**
 * rendering meter bar count
 */


function renderCount(props) {
  const {
    value,
    numberAlignType
  } = props;
  return react_1.default.createElement(styled_1.MeterCount, {
    orderArrange: deps_1.getBarCountPosition(numberAlignType)
  }, value);
}

exports.renderCount = renderCount;
/**
 * rendering progress bar
 */

function renderProgressBar(props) {
  // IMPORTANT: these props need to be actual numbers for this to work!!
  //            this fails if any of these props are strings
  const {
    value,
    min,
    max,
    meterWidth
  } = props; // NOTE: the value needs to adjusted by the min & max limits

  const adjustedValue = value > max ? max : value < min ? min : value - min;
  console.log('-- renderProgressBar: ', min, max, value, adjustedValue);
  const meterProps = {
    barWidth: meterWidth,
    currentValue: adjustedValue,
    totalValue: max
  };
  return react_1.default.createElement(ProgressBar_1.ProgressBar, Object.assign({}, meterProps));
}

exports.renderProgressBar = renderProgressBar;
/**
 * rendering main wrapper of the meter bar
 */

function renderWrapper(props) {
  const {
    children
  } = props;
  return react_1.default.createElement(styled_1.MeterBarWrap, null, children);
}

exports.renderWrapper = renderWrapper; //# sourceMappingURL=renderProps.js.map