docker_manager/admin/assets/javascripts/discourse/components/docker-manager/progress-bar.gjs
Jarek Radosz ea174f7e36
DEV: Clean up the code (#245)
gjs, helper invocation case, typos, latest license template, unnecessary tracking, concatClass, unnecessary service injection, new imports, whitespace, pure function helper, htmlSafe calling convention, this. in template, unused vars in ruby, update linting, qunit-dom
2024-10-23 11:21:22 +02:00

25 lines
628 B
Text

import Component from "@glimmer/component";
import { htmlSafe } from "@ember/template";
import concatClass from "discourse/helpers/concat-class";
export default class ProgressBar extends Component {
get active() {
return parseInt(this.args.percent, 10) !== 100;
}
get barStyle() {
let percent = parseInt(this.args.percent, 10);
if (percent > 100) {
percent = 100;
}
return htmlSafe(`width: ${percent}%`);
}
<template>
<div class={{concatClass "progress-bar" (if this.active "active")}}>
<div class="progress-bar-inner" style={{this.barStyle}}></div>
</div>
</template>
}