Added fiat balance to address and made fiat balance into a component.
This commit is contained in:
1
frontend/src/app/fiat/fiat.component.html
Normal file
1
frontend/src/app/fiat/fiat.component.html
Normal file
@@ -0,0 +1 @@
|
||||
<span class="green-color">{{ (conversions$ | async)?.USD * value / 100000000 | currency:'USD':'symbol':'1.2-2' }}</span>
|
||||
3
frontend/src/app/fiat/fiat.component.scss
Normal file
3
frontend/src/app/fiat/fiat.component.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
.green-color {
|
||||
color: #3bcc49;
|
||||
}
|
||||
25
frontend/src/app/fiat/fiat.component.spec.ts
Normal file
25
frontend/src/app/fiat/fiat.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
24
frontend/src/app/fiat/fiat.component.ts
Normal file
24
frontend/src/app/fiat/fiat.component.ts
Normal 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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user