layout adjusted to use mat-angular components
This commit is contained in:
@@ -2,7 +2,18 @@
|
||||
class="score-bar"
|
||||
[class.score-bar--success]="variant() === 'success'"
|
||||
[class.score-bar--warn]="variant() === 'warn'">
|
||||
<span class="score-bar__label">{{ label() }}</span>
|
||||
<span
|
||||
class="score-bar__label"
|
||||
[class.score-bar__label--hinted]="!!hint()"
|
||||
[matTooltip]="hint() ?? ''"
|
||||
[matTooltipDisabled]="!hint()"
|
||||
matTooltipPosition="above"
|
||||
matTooltipClass="tooltip-sm">
|
||||
<span class="score-bar__label-text">{{ label() }}</span>
|
||||
@if (hint()) {
|
||||
<mat-icon class="score-bar__hint" aria-hidden="true">help_outline</mat-icon>
|
||||
}
|
||||
</span>
|
||||
<span class="score-bar__track">
|
||||
<span class="score-bar__fill" [style.width.%]="pct()"></span>
|
||||
@if (thresholdPct() !== null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.score-bar {
|
||||
display: grid;
|
||||
grid-template-columns: 96px 1fr 48px;
|
||||
grid-template-columns: minmax(0, 132px) 1fr 50px;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
@@ -9,12 +9,31 @@
|
||||
}
|
||||
|
||||
.score-bar__label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
min-width: 0;
|
||||
color: var(--sg-text-muted);
|
||||
|
||||
&--hinted {
|
||||
cursor: help;
|
||||
}
|
||||
}
|
||||
|
||||
.score-bar__label-text {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.score-bar__hint {
|
||||
flex: none;
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
.score-bar__track {
|
||||
position: relative;
|
||||
display: block;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
|
||||
export type ScoreBarVariant = 'primary' | 'success' | 'warn';
|
||||
|
||||
@@ -10,6 +12,7 @@ export type ScoreBarVariant = 'primary' | 'success' | 'warn';
|
||||
@Component({
|
||||
selector: 'app-score-bar',
|
||||
standalone: true,
|
||||
imports: [MatIconModule, MatTooltipModule],
|
||||
templateUrl: './score-bar.component.html',
|
||||
styleUrl: './score-bar.component.scss',
|
||||
})
|
||||
@@ -23,6 +26,8 @@ export class ScoreBarComponent {
|
||||
readonly display = input<string | null | undefined>(null);
|
||||
/** Optional threshold (same units as `value`), drawn as a dashed marker. */
|
||||
readonly threshold = input<number | null | undefined>(null);
|
||||
/** Optional explanation, shown as a tooltip on the label. */
|
||||
readonly hint = input<string | null | undefined>(null);
|
||||
readonly variant = input<ScoreBarVariant>('primary');
|
||||
|
||||
readonly pct = computed<number>(() => {
|
||||
|
||||
Reference in New Issue
Block a user