Store and display stats and node top lists
This commit is contained in:
3
frontend/src/app/components/change/change.component.html
Normal file
3
frontend/src/app/components/change/change.component.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<span [style]="change >= 0 ? 'color: #42B747' : 'color: #B74242'">
|
||||
{{ change >= 0 ? '+' : '' }}{{ change | amountShortener }}%
|
||||
</span>
|
||||
21
frontend/src/app/components/change/change.component.ts
Normal file
21
frontend/src/app/components/change/change.component.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-change',
|
||||
templateUrl: './change.component.html',
|
||||
styleUrls: ['./change.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class ChangeComponent implements OnChanges {
|
||||
@Input() current: number;
|
||||
@Input() previous: number;
|
||||
|
||||
change: number;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnChanges(): void {
|
||||
this.change = (this.current - this.previous) / this.previous * 100;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user