updated app-chip component to accept isActive parameter
This commit is contained in:
@@ -18,6 +18,15 @@
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
gap: 2px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--chip-color) 20%,
|
||||
var(--sg-color-mix-base)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
:host(.outlined) {
|
||||
@@ -28,3 +37,9 @@
|
||||
);
|
||||
background: var(--sg-surface);
|
||||
}
|
||||
|
||||
:host(.active) {
|
||||
border-color: var(--chip-color);
|
||||
box-shadow: 0 0 0 1px var(--chip-color);
|
||||
background: color-mix(in srgb, var(--chip-color) 8%, var(--sg-surface));
|
||||
}
|
||||
|
||||
@@ -32,12 +32,17 @@ const CHIP_COLORS: Record<string, string> = {
|
||||
export class ChipComponent {
|
||||
@Input() variant: ChipVariant = 'normal';
|
||||
@Input() color: ChipColor = 'primary';
|
||||
|
||||
@Input() active: boolean = false;
|
||||
@HostBinding('class.outlined')
|
||||
get outlined(): boolean {
|
||||
return this.variant === 'outlined';
|
||||
}
|
||||
|
||||
@HostBinding('class.active')
|
||||
get isActive(): boolean {
|
||||
return this.active;
|
||||
}
|
||||
|
||||
@HostBinding('style.--chip-color')
|
||||
get chipColor(): string {
|
||||
return CHIP_COLORS[this.color] ?? this.color;
|
||||
|
||||
Reference in New Issue
Block a user