import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';

@Component({
    selector: 'progress-bar',
    templateUrl: './bar.component.html',
    styleUrls: ['./bar.component.css']
})
export class ProgressBarComponent implements OnInit {
    @Input('bg-class') bgClass: string;
    @Input() value: number = 0;
    @Input() max: number = 100;

    ngOnInit(): void {
    }

    getWidth() {
        let value = this.value * 100 / this.max;
        if(value > 100) value = 100;
        return value + '%';
    }
    getValue(): string {
        return this.max + ' / ' + this.value;
    }
}