File

src/app/tool-page/stat-badge/stat-badge.component.ts

Description

Displays a single number and title in a pill container.

Metadata

selector app-stat-badge
styleUrls stat-badge.component.css
templateUrl ./stat-badge.component.html

Index

Inputs

Constructor

constructor()

Constructor

Inputs

side

The side of the pill the number should be display on.

Type: string

Default value: 'right'

statCount

The number to display.

Type: number

statTitle

The title to display on the pill.

Type: string

titleColor

The color of the title.

Type: string

Default value: 'white'

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>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""