1
1
import { AfterContentInit , ChangeDetectionStrategy , Component , ContentChildren , QueryList } from '@angular/core' ;
2
2
import { ActivatedRoute } from '@angular/router' ;
3
- import { FeatureState , NavigationParams , NavigationParamsType , NavigationService } from '@hypertrace/common' ;
3
+ import { Color , FeatureState , NavigationParams , NavigationParamsType , NavigationService } from '@hypertrace/common' ;
4
4
import { merge , Observable } from 'rxjs' ;
5
5
import { map , startWith } from 'rxjs/operators' ;
6
6
import { NavigableTabComponent } from './navigable-tab.component' ;
@@ -22,6 +22,14 @@ import { NavigableTabComponent } from './navigable-tab.component';
22
22
class="tab-link"
23
23
>
24
24
<ng-container *ngTemplateOutlet="tab.content"></ng-container>
25
+ <ng-container *ngIf="tab.labelTag">
26
+ <ht-label-tag
27
+ class="tab-label-tag"
28
+ [label]="tab.labelTag"
29
+ [backgroundColor]="this.getBackgroundColor(activeTab, tab)"
30
+ [labelColor]="this.getLabelColor(activeTab, tab)"
31
+ ></ht-label-tag>
32
+ </ng-container>
25
33
<span *ngIf="featureState === '${ FeatureState . Preview } '" class="soon-container">
26
34
<span class="soon">SOON</span>
27
35
</span>
@@ -60,6 +68,14 @@ export class NavigableTabGroupComponent implements AfterContentInit {
60
68
replaceCurrentHistory : tab . replaceHistory
61
69
} ) ;
62
70
71
+ public getBackgroundColor ( activeTab : NavigableTabComponent | undefined , tab : NavigableTabComponent ) : Color {
72
+ return activeTab === tab ? Color . Gray9 : Color . Gray2 ;
73
+ }
74
+
75
+ public getLabelColor ( activeTab : NavigableTabComponent | undefined , tab : NavigableTabComponent ) : Color {
76
+ return activeTab === tab ? Color . White : Color . Gray5 ;
77
+ }
78
+
63
79
private findActiveTab ( ) : NavigableTabComponent | undefined {
64
80
return this . tabs . find ( tab => this . navigationService . isRelativePathActive ( [ tab . path ] , this . activatedRoute ) ) ;
65
81
}
0 commit comments