DEV: Modernize progress-bar component
This commit is contained in:
parent
a6260a5270
commit
71de0a1ec7
|
@ -1,7 +1,3 @@
|
|||
<div class="progress progress-striped {{if this.active 'active'}}">
|
||||
<div
|
||||
class="progress-bar progress-bar-striped
|
||||
{{if this.active 'progress-bar-animated'}}"
|
||||
style={{barStyle}}
|
||||
></div>
|
||||
<div class="progress-bar {{if this.active 'active'}}">
|
||||
<div class="progress-bar-inner" style={{this.barStyle}}></div>
|
||||
</div>
|
||||
|
|
|
@ -1,23 +1,18 @@
|
|||
import Component from "@ember/component";
|
||||
import { computed } from "@ember/object";
|
||||
import Component from "@glimmer/component";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "",
|
||||
export default class ProgressBar extends Component {
|
||||
get active() {
|
||||
return parseInt(this.args.percent, 10) !== 100;
|
||||
}
|
||||
|
||||
active: computed("percent", function () {
|
||||
return parseInt(this.get("percent"), 10) !== 100;
|
||||
}),
|
||||
get barStyle() {
|
||||
let percent = parseInt(this.args.percent, 10);
|
||||
|
||||
barStyle: computed("percent", function () {
|
||||
let percent = parseInt(this.get("percent"), 10);
|
||||
if (percent > 0) {
|
||||
if (percent > 100) {
|
||||
percent = 100;
|
||||
}
|
||||
return htmlSafe("width: " + this.get("percent") + "%");
|
||||
if (percent > 100) {
|
||||
percent = 100;
|
||||
}
|
||||
|
||||
return htmlSafe("");
|
||||
}),
|
||||
});
|
||||
return htmlSafe(`width: ${percent}%`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<h3>Upgrade {{title}}</h3>
|
||||
|
||||
{{progress-bar percent=percent}}
|
||||
<ProgressBar @percent={{this.percent}} />
|
||||
|
||||
{{#if complete}}
|
||||
<p>Upgrade completed successfully!</p>
|
||||
|
|
|
@ -90,9 +90,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
div.progress {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
.progress-bar {
|
||||
background: var(--primary-100);
|
||||
border: 1px solid var(--primary-200);
|
||||
height: 1.5rem;
|
||||
margin: 1rem 0;
|
||||
|
||||
&-inner {
|
||||
background: var(--tertiary-400);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&.active &-inner {
|
||||
background: var(--tertiary-800);
|
||||
}
|
||||
}
|
||||
|
||||
th {
|
||||
|
|
Loading…
Reference in New Issue