src/app/tool-page/stat-badge/stat-badge.component.ts
Displays a single number and title in a pill container.
| selector | app-stat-badge |
| styleUrls | stat-badge.component.css |
| templateUrl | ./stat-badge.component.html |
Inputs |
constructor()
|
|
Constructor |
side
|
The side of the pill the number should be display on.
Type:
Default value: |
statCount
|
The number to display.
Type: |
statTitle
|
The title to display on the pill.
Type: |
titleColor
|
The color of the title.
Type:
Default value: |
import { Component, Input } from '@angular/core';
/**
* Displays a single number and title in a pill container.
*/
@Component({
selector: 'app-stat-badge',
templateUrl: './stat-badge.component.html',
styleUrls: ['./stat-badge.component.css']
})
export class StatBadgeComponent {
/**
* The title to display on the pill.
*/
@Input('statTitle') statTitle: string;
/**
* The number to display.
*/
@Input('statCount') statCount: number;
/**
* The color of the title.
*/
@Input('titleColor') titleColor: string = 'white';
/**
* The side of the pill the number should be display on.
*/
@Input('side') side: string = 'right';
/**
* Constructor
*/
constructor() { }
}
<div [ngSwitch]="side" class="statBadge blue-grey darken-3 z-depth-2">
<div *ngSwitchCase="'right'">
<div class="statBadge__title right-side" [style.color]="titleColor">
{{statTitle}}
</div>
<div class="statBadge__count z-depth-1 blue-text text-accent-3">
{{statCount || '--'}}
</div>
</div>
<div *ngSwitchCase="'left'">
<div class="statBadge__count z-depth-1 blue-text text-accent-3 ">
{{statCount || '--'}}
</div>
<div class="statBadge__title left-side" [style.color]="titleColor">
{{statTitle}}
</div>
</div>
</div>