38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import { Component, Input } from '@angular/core';
|
|
import { MatCardModule } from '@angular/material/card';
|
|
|
|
@Component({
|
|
selector: 'app-indicador-kpi-card',
|
|
imports: [MatCardModule],
|
|
template: `
|
|
<mat-card>
|
|
<h3>{{ title }}</h3>
|
|
@if (value !== null && value !== undefined) {
|
|
<p class="value">{{ value }}@if (unit) { <span>{{ unit }}</span> }</p>
|
|
}
|
|
@if (temporalReference) { <p>{{ temporalReference }}</p> }
|
|
<p class="kpi-state">{{ state }}</p>
|
|
@if (additionalInfo) { <p class="additional-info">{{ additionalInfo }}</p> }
|
|
</mat-card>
|
|
`,
|
|
styles: `
|
|
:host { display: block; min-width: 0; }
|
|
mat-card { box-sizing: border-box; height: 100%; padding: var(--issste-space-6);
|
|
background: var(--issste-surface); color: var(--issste-text); border: 1px solid var(--issste-border);
|
|
border-radius: var(--issste-radius); box-shadow: none; }
|
|
h3 { margin: 0; font-family: var(--issste-font-heading); font-size: 1.25rem; line-height: 1.3; }
|
|
h3, p { overflow-wrap: anywhere; }
|
|
p { margin: var(--issste-space-3) 0 0; }
|
|
.kpi-state, .additional-info { color: var(--issste-text-secondary); font: var(--mat-sys-body-medium); }
|
|
.value { font: var(--mat-sys-headline-medium); }
|
|
`,
|
|
})
|
|
export class IndicadorKpiCard {
|
|
@Input({ required: true }) title!: string;
|
|
@Input() value?: string | number | null;
|
|
@Input() unit?: string;
|
|
@Input() temporalReference?: string;
|
|
@Input() state = 'Pendiente de definición';
|
|
@Input() additionalInfo?: string;
|
|
}
|