Skip to content

Commit c4820b1

Browse files
authored
Merge branch 'main' into summary-card-update
2 parents 6a4ab74 + 12f802a commit c4820b1

File tree

14 files changed

+57
-23
lines changed

14 files changed

+57
-23
lines changed

projects/components/src/combo-box/combo-box.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
}
114114

115115
.popover-item {
116+
@include body-1-regular($gray-7);
116117
height: 36px;
117118
padding: 2px 12px;
118119
cursor: pointer;

projects/components/src/input/input.component.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@import 'mixins';
12
@import 'color-palette';
23

34
:host {
@@ -31,6 +32,7 @@
3132
padding-bottom: 0;
3233

3334
.mat-form-field-label {
35+
@include body-1-regular($gray-7);
3436
padding: 0 0 0 8px;
3537
line-height: initial;
3638
color: $gray-5;

projects/components/src/link/link.component.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
@import 'color-palette';
33

44
.ht-link {
5+
display: flex;
6+
align-items: center;
57
text-decoration-line: none;
68
text-decoration: none;
79
color: inherit;

projects/components/src/tabs/content/tab-group.component.scss

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,8 @@
7878
flex-direction: row;
7979
align-items: center;
8080

81-
.tab-badge {
82-
@include font-label($gray-5);
83-
display: flex;
84-
justify-content: center;
85-
text-align: center;
86-
margin-left: 6px;
87-
padding: 0 6px;
88-
height: 16px;
89-
background-color: $gray-2;
90-
border-radius: 8px;
91-
92-
&.active {
93-
background-color: $gray-9;
94-
color: white;
95-
}
81+
.tab-label-tag {
82+
margin-left: 4px;
9683
}
9784
}
9885

projects/components/src/tabs/content/tab-group.component.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ChangeDetectionStrategy, Component, ContentChildren, QueryList } from '@angular/core';
2+
import { Color } from '@hypertrace/common';
23
import { TabComponent } from './tab/tab.component';
34

45
@Component({
@@ -12,9 +13,14 @@ import { TabComponent } from './tab/tab.component';
1213
<ng-template mat-tab-label>
1314
<div class="tab-label">
1415
{{ tab.label }}
15-
<div *ngIf="tab.badge" [ngClass]="{ active: activeTabIndex === i }" class="tab-badge">
16-
{{ tab.badge }}
17-
</div>
16+
<ng-container *ngIf="tab.labelTag">
17+
<ht-label-tag
18+
class="tab-label-tag"
19+
[label]="tab.labelTag"
20+
[backgroundColor]="this.getBackgroundColor(i)"
21+
[labelColor]="this.getLabelColor(i)"
22+
></ht-label-tag>
23+
</ng-container>
1824
</div>
1925
<div class="ink-bar" [ngClass]="{ active: activeTabIndex === i }"></div>
2026
</ng-template>
@@ -31,4 +37,12 @@ export class TabGroupComponent {
3137
public tabs!: QueryList<TabComponent>;
3238

3339
public activeTabIndex: number = 0;
40+
41+
public getBackgroundColor(index: number): Color {
42+
return this.activeTabIndex === index ? Color.Gray9 : Color.Gray2;
43+
}
44+
45+
public getLabelColor(index: number): Color {
46+
return this.activeTabIndex === index ? Color.White : Color.Gray5;
47+
}
3448
}

projects/components/src/tabs/content/tab.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { CommonModule } from '@angular/common';
22
import { NgModule } from '@angular/core';
33
import { MatTabsModule } from '@angular/material/tabs';
44
import { RouterModule } from '@angular/router';
5+
import { LabelTagModule } from '../../label-tag/label-tag.module';
56
import { TabGroupComponent } from './tab-group.component';
67
import { TabComponent } from './tab/tab.component';
78

89
@NgModule({
910
declarations: [TabGroupComponent, TabComponent],
1011
exports: [TabGroupComponent, TabComponent],
11-
imports: [MatTabsModule, CommonModule, RouterModule]
12+
imports: [MatTabsModule, CommonModule, RouterModule, LabelTagModule]
1213
})
1314
export class TabModule {}

projects/components/src/tabs/content/tab/tab.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export class TabComponent extends ContentHolder {
1212
public label!: string;
1313

1414
@Input()
15-
public badge?: string;
15+
public labelTag?: string;
1616
}

projects/components/src/tabs/navigable/navigable-tab-group.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
padding-bottom: 6px;
7474
}
7575

76+
.tab-label-tag {
77+
margin-left: 4px;
78+
}
79+
7680
.ink-bar {
7781
height: 2px; // plus tab-link is 48
7882
border-radius: 1px;

projects/components/src/tabs/navigable/navigable-tab-group.component.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AfterContentInit, ChangeDetectionStrategy, Component, ContentChildren, QueryList } from '@angular/core';
22
import { ActivatedRoute } from '@angular/router';
3-
import { FeatureState, NavigationParams, NavigationParamsType, NavigationService } from '@hypertrace/common';
3+
import { Color, FeatureState, NavigationParams, NavigationParamsType, NavigationService } from '@hypertrace/common';
44
import { merge, Observable } from 'rxjs';
55
import { map, startWith } from 'rxjs/operators';
66
import { NavigableTabComponent } from './navigable-tab.component';
@@ -22,6 +22,14 @@ import { NavigableTabComponent } from './navigable-tab.component';
2222
class="tab-link"
2323
>
2424
<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>
2533
<span *ngIf="featureState === '${FeatureState.Preview}'" class="soon-container">
2634
<span class="soon">SOON</span>
2735
</span>
@@ -60,6 +68,14 @@ export class NavigableTabGroupComponent implements AfterContentInit {
6068
replaceCurrentHistory: tab.replaceHistory
6169
});
6270

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+
6379
private findActiveTab(): NavigableTabComponent | undefined {
6480
return this.tabs.find(tab => this.navigationService.isRelativePathActive([tab.path], this.activatedRoute));
6581
}

projects/components/src/tabs/navigable/navigable-tab.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export class NavigableTabComponent extends ContentHolder {
1818
@Input()
1919
public hidden: boolean = false;
2020

21+
@Input()
22+
public labelTag?: string;
23+
2124
@Input()
2225
public replaceHistory?: boolean;
2326

0 commit comments

Comments
 (0)