19 lines
485 B
JavaScript
19 lines
485 B
JavaScript
export class ProgressBar {
|
|
constructor() {
|
|
this.percentage = document.getElementById("progress-percentage");
|
|
this.indicator = document.getElementById("progress-indicator");
|
|
}
|
|
|
|
setStatus(status) {
|
|
this.percentage.innerText = status;
|
|
this.indicator.style.clipPath = "rect(0 0 100% 0)";
|
|
}
|
|
|
|
setProgress(progress) {
|
|
const percent = (progress * 100).toFixed(1) + "%";
|
|
|
|
this.percentage.innerText = percent;
|
|
this.indicator.style.clipPath = `rect(0 ${percent} 100% 0)`;
|
|
}
|
|
}
|