From 2474700473575904f303920ae0419ec8a8a3fbbb Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Sat, 1 Aug 2026 20:35:21 +0200 Subject: [PATCH] refactored from legacy host binding to use modern @component (host: ) implementation --- .../ui/topic-chip/topic-chip.component.ts | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts index e7c1e0a5..9e01588f 100644 --- a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts +++ b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts @@ -1,10 +1,4 @@ -import { - Component, - EventEmitter, - HostBinding, - Input, - Output, -} from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; import { buildTopicHierarchyTooltip } from '../../../resolvers/utils/topic-tooltip'; @@ -75,6 +69,18 @@ export const topicChipColorTokens = ( templateUrl: './topic-chip.component.html', styleUrl: './topic-chip.component.scss', standalone: true, + host: { + '[class.topic-chip--normal]': 'normalSize', + '[class.topic-chip--mini]': 'miniSize', + '[class.topic-chip--active]': 'activeState', + '[style.--topic-border]': 'topicBorder', + '[style.--topic-bg]': 'topicBackground', + '[style.--topic-active-bg]': 'topicActiveBackground', + '[style.--topic-color]': 'topicColor', + '[style.--topic-text]': 'topicText', + '[style.--topic-count-bg]': 'topicCountBackground', + '[style.--topic-count-text]': 'topicCountText', + }, }) export class TopicChipComponent { @Input() label = ''; @@ -93,22 +99,18 @@ export class TopicChipComponent { @Output() chipClick = new EventEmitter(); - @HostBinding('class.topic-chip--normal') get normalSize(): boolean { return this.size === 'normal'; } - @HostBinding('class.topic-chip--mini') get miniSize(): boolean { return this.size === 'mini'; } - @HostBinding('class.topic-chip--active') get activeState(): boolean { return this.active; } - @HostBinding('style.--topic-border') get topicBorder(): string { return ( this.colorTokens?.border ?? @@ -116,7 +118,6 @@ export class TopicChipComponent { ); } - @HostBinding('style.--topic-bg') get topicBackground(): string { return ( this.colorTokens?.background ?? @@ -124,7 +125,6 @@ export class TopicChipComponent { ); } - @HostBinding('style.--topic-active-bg') get topicActiveBackground(): string { return ( this.colorTokens?.activeBackground ?? @@ -132,24 +132,20 @@ export class TopicChipComponent { ); } - @HostBinding('style.--topic-color') get topicColor(): string { return this.colorTokens?.color ?? this.color; } - @HostBinding('style.--topic-text') get topicText(): string { return this.colorTokens?.color ? this.colorTokens.color - : `color-mix(in srgb, ${this.topicColor} 38%, var(--sg-text))`; + : `color-mix(in srgb, ${this.topicColor} 45%, var(--sg-text))`; } - @HostBinding('style.--topic-count-bg') get topicCountBackground(): string { return this.colorTokens?.background ?? 'var(--sg-surface)'; } - @HostBinding('style.--topic-count-text') get topicCountText(): string { return this.colorTokens?.color ? this.colorTokens.color