Added fiat balance to address and made fiat balance into a component.

This commit is contained in:
softsimon
2020-03-02 17:29:00 +07:00
parent d28730787a
commit 669a5e429d
11 changed files with 60 additions and 15 deletions

View File

@@ -0,0 +1 @@
<span class="green-color">{{ (conversions$ | async)?.USD * value / 100000000 | currency:'USD':'symbol':'1.2-2' }}</span>

View File

@@ -0,0 +1,3 @@
.green-color {
color: #3bcc49;
}

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FiatComponent } from './fiat.component';
describe('FiatComponent', () => {
let component: FiatComponent;
let fixture: ComponentFixture<FiatComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FiatComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FiatComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,24 @@
import { Component, OnInit, ChangeDetectionStrategy, Input } from '@angular/core';
import { Observable } from 'rxjs';
import { StateService } from '../services/state.service';
@Component({
selector: 'app-fiat',
templateUrl: './fiat.component.html',
styleUrls: ['./fiat.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FiatComponent implements OnInit {
conversions$: Observable<any>;
@Input() value: number;
constructor(
private stateService: StateService,
) { }
ngOnInit(): void {
this.conversions$ = this.stateService.conversions$.asObservable();
}
}