Initial commit: Aeroflot Flights Web Angular 12 application
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
<span *ngIf="!this.clarifying" class="duration">{{ duration | duration }}</span>
|
||||
<span *ngIf="this.clarifying" class="duration duration--clarifying">{{ 'FLIGHT-STATUSES.Unknown' | translate }}</span>
|
||||
@@ -0,0 +1,9 @@
|
||||
@use './src/styles/framework' as *;
|
||||
|
||||
.duration {
|
||||
@include font-overflow;
|
||||
|
||||
&--clarifying {
|
||||
color: $orange;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { getMockPipe } from '@shared/pipes/pipe.mock';
|
||||
import { DurationComponent } from './duration.component';
|
||||
|
||||
describe('DurationComponent', () => {
|
||||
let component: DurationComponent;
|
||||
let fixture: ComponentFixture<DurationComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [DurationComponent, getMockPipe('duration')],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DurationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
|
||||
import { Duration, getTotalMinutes } from '@app/shared/models-legacy';
|
||||
|
||||
@Component({
|
||||
selector: 'duration',
|
||||
templateUrl: './duration.component.html',
|
||||
styleUrls: ['./duration.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class DurationComponent implements OnChanges {
|
||||
@Input() duration: Duration;
|
||||
clarifying = false;
|
||||
|
||||
ngOnChanges() {
|
||||
const minutes = getTotalMinutes(this.duration);
|
||||
|
||||
this.clarifying = minutes < 15;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user