Bisq dashboard: Change color between red/green when price changes
This commit is contained in:
1 parent
55e303de9a
commit
451e265ae9
4 files changed
+35
-2
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { Directive, ElementRef, Input, OnChanges } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[appColoredPrice]',
|
||||
})
|
||||
export class ColoredPriceDirective implements OnChanges {
|
||||
@Input() appColoredPrice: number;
|
||||
previousValue = null;
|
||||
|
||||
constructor(
|
||||
private element: ElementRef
|
||||
) { }
|
||||
|
||||
ngOnChanges() {
|
||||
if (this.previousValue && this.appColoredPrice < this.previousValue) {
|
||||
this.element.nativeElement.classList.add('red-color');
|
||||
} else {
|
||||
this.element.nativeElement.classList.remove('red-color');
|
||||
}
|
||||
this.previousValue = this.appColoredPrice;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user