Skip to content

Commit d1428d0

Browse files
authored
feat: adding inherit color from text input to entity (#826)
1 parent f776f3d commit d1428d0

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

projects/observability/src/shared/components/entity-renderer/entity-renderer.component.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
@import 'font';
33

44
.ht-entity-renderer {
5+
@include body-1-regular(currentColor);
56
display: flex;
67
flex-direction: row;
78
align-items: center;
89
font-weight: inherit;
9-
@include body-1-regular();
10+
color: $gray-9;
1011

1112
.icon {
1213
padding-right: 12px;
@@ -20,3 +21,7 @@
2021
.navigable {
2122
@include link-hover();
2223
}
24+
25+
.inherit-text-color {
26+
@include body-1-regular(inherit);
27+
}

projects/observability/src/shared/components/entity-renderer/entity-renderer.component.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,32 @@ describe('Entity Renderer Component', () => {
134134
});
135135
expect(spectator.query(IconComponent)?.icon).toEqual(IconType.Add);
136136
});
137+
138+
test('should inherit text color when enabled', () => {
139+
const entity = {
140+
[entityIdKey]: 'test-id',
141+
[entityTypeKey]: ObservabilityEntityType.Api,
142+
name: 'test api'
143+
};
144+
145+
spectator = createHost(
146+
`<ht-entity-renderer [entity]="entity" [inheritTextColor]="inheritTextColor">
147+
</ht-entity-renderer>`,
148+
{
149+
hostProps: {
150+
entity: entity,
151+
inheritTextColor: false
152+
}
153+
}
154+
);
155+
156+
expect(spectator.query('.inherit-text-color')).not.toExist();
157+
158+
spectator.setHostInput({
159+
inheritTextColor: true
160+
});
161+
expect(spectator.query('.inherit-text-color')).toExist();
162+
163+
expect(spectator.query('.ht-entity-renderer')).toEqual(spectator.query('.inherit-text-color'));
164+
});
137165
});

projects/observability/src/shared/components/entity-renderer/entity-renderer.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { EntityNavigationService } from '../../services/navigation/entity/entity
1313
<div
1414
*ngIf="this.name"
1515
class="ht-entity-renderer"
16-
[ngClass]="{ navigable: this.navigable }"
16+
[ngClass]="{ navigable: this.navigable, 'inherit-text-color': this.inheritTextColor }"
1717
[htTooltip]="this.name"
1818
(click)="this.navigable && this.onClickNavigate()"
1919
>
@@ -44,6 +44,9 @@ export class EntityRendererComponent implements OnChanges {
4444
@Input()
4545
public showIcon: boolean = false;
4646

47+
@Input()
48+
public inheritTextColor: boolean = false;
49+
4750
public name?: string;
4851
public entityIconType?: string;
4952

0 commit comments

Comments
 (0)