@arche-mc2/arche-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
53 lines • 2.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var typestyle_1 = require("typestyle");
var currency_1 = require("../../../Common/utils/currency");
var classnames = require("classnames");
var react_countup_1 = require("react-countup");
var Box_1 = require("../../Containers/Box");
var UpCurrency = function (props) {
var bigNumber = typestyle_1.style({
$nest: {
"&.up-number-integer": {
fontSize: (props.integerFontSize ? props.integerFontSize : 40) + "px",
lineHeight: (props.integerLineHeight
? props.integerLineHeight
: (props.integerFontSize ? props.integerFontSize : 40) + 8) + "px",
fontWeight: props.integerFontWeight
? props.integerFontWeight
: "normal",
color: props.color && props.value > 0 ? props.color : "#D7D7D7"
}
}
});
var smallNumber = typestyle_1.style({
$nest: {
"&.up-number-decimal": {
marginTop: "8px",
fontSize: (props.decimalFontSize ? props.decimalFontSize : 14) + "px",
fontWeight: 500,
lineHeight: (props.decimalLineHeight
? props.decimalLineHeight
: (props.decimalFontSize ? props.decimalFontSize : 14) + 2) + "px",
color: props.value > 0 ? props.secondColor || "#9B9B9B" : "#D7D7D7"
}
}
});
var countUp = (props.animate
? react_countup_1.useCountUp({
start: 0,
decimals: 2,
delay: props.delay || 0,
end: props.value
})
: { countUp: 0 }).countUp;
return (React.createElement(Box_1.default, { justifyContent: "center", style: { height: "100%" } },
React.createElement(Box_1.default, { flexDirection: "row", justifyContent: "center" },
React.createElement("span", { className: classnames("up-number-integer", bigNumber) }, currency_1.getIntegerValue((props.animate ? countUp : props.value), " ")),
React.createElement("span", { className: classnames("up-number-decimal", smallNumber) },
currency_1.getDecimalValue((props.animate ? countUp : props.value), 2),
props.unit ? props.unit : ""))));
};
exports.default = UpCurrency;
//# sourceMappingURL=UpCurrency.js.map