UNPKG

@talentsoft-opensource/uxp-themes

Version:

Talentsoft UX themes

22 lines (21 loc) 796 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var StatsBar = /** @class */ (function () { function StatsBar($element) { this.elStatsBar = $element; this.animateBar(); } StatsBar.prototype.animateBar = function () { var max = this.elStatsBar.getAttribute('data-max'); var current = this.elStatsBar.getAttribute('data-current'); var result = this.elStatsBar.querySelector('.stats-bar__result'); if (result !== null) { result.style.transform = "translate(" + this.calculatePourcent(current, max) + "%, -50%)"; } }; StatsBar.prototype.calculatePourcent = function (current, max) { return (current / max) * 100; }; return StatsBar; }()); exports.default = StatsBar;