2017-08-22 10:53:26 +03:00
|
|
|
import Component from '@ember/component';
|
2022-02-01 12:34:03 +03:00
|
|
|
import classic from 'ember-classic-decorator';
|
2021-05-12 14:33:36 +03:00
|
|
|
import {htmlSafe} from '@ember/template';
|
2022-02-01 12:34:03 +03:00
|
|
|
import {tagName} from '@ember-decorators/component';
|
2017-05-08 13:35:42 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@classic
|
|
|
|
@tagName('')
|
|
|
|
export default class GhProgressBar extends Component {
|
2017-05-08 13:35:42 +03:00
|
|
|
// Public attributes
|
2022-02-01 12:34:03 +03:00
|
|
|
percentage = 0;
|
|
|
|
|
|
|
|
isError = false;
|
2017-05-08 13:35:42 +03:00
|
|
|
|
|
|
|
// Internal attributes
|
2022-02-01 12:34:03 +03:00
|
|
|
progressStyle = '';
|
2017-05-08 13:35:42 +03:00
|
|
|
|
|
|
|
didReceiveAttrs() {
|
2022-02-01 12:34:03 +03:00
|
|
|
super.didReceiveAttrs(...arguments);
|
2017-05-08 13:35:42 +03:00
|
|
|
|
2019-03-06 16:53:54 +03:00
|
|
|
let percentage = this.percentage;
|
2017-05-08 13:35:42 +03:00
|
|
|
let width = (percentage > 0) ? `${percentage}%` : '0';
|
|
|
|
|
|
|
|
this.set('progressStyle', htmlSafe(`width: ${width}`));
|
|
|
|
}
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|