import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'progressBarLine', standalone: true, }) export class ProgressBarLinePipe implements PipeTransform { transform(type: 'back' | 'front', percentageValue: number): Record { if (type === 'back') { return { expired: percentageValue === 0, 'back-gray': percentageValue > 50, 'back-yellow': percentageValue > 20 && percentageValue <= 50, 'back-red': percentageValue <= 20 && percentageValue > 0, }; } // type === 'front' return { 'front-gray': percentageValue > 50, 'front-yellow': percentageValue > 20 && percentageValue <= 50, 'front-red': percentageValue <= 20, }; } }