Skip to content

Commit

Permalink
fix: added style for selection in metric card (#1690)
Browse files Browse the repository at this point in the history
Co-authored-by: Ankit Das <[email protected]>
  • Loading branch information
Greedy-Geek and Ankit Das authored Jun 14, 2022
1 parent ae08818 commit 30fd3dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion projects/components/src/metric-card/metric-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MetricCardIndicatorType } from './metric-card';
styleUrls: ['./metric-card.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="metric-card" [style.backgroundColor]="this.backgroundColor" [style.borderColor]="this.borderColor">
<div class="metric-card" [ngStyle]="this.getStylesForCard()">
<div class="indicator-and-title">
<div class="indicator">
<ng-container [ngSwitch]="this.indicator">
Expand Down Expand Up @@ -52,4 +52,13 @@ export class MetricCardComponent {

@Input()
public borderColor: Color = Color.Transparent;

@Input()
public isSelected: boolean = false;

public getStylesForCard(): { 'background-color': string; 'border-color': string } {
return this.isSelected
? { 'background-color': Color.Blue1, 'border-color': Color.Blue4 }
: { 'background-color': this.backgroundColor, 'border-color': this.borderColor };
}
}

0 comments on commit 30fd3dd

Please sign in to comment.