mirror of
https://github.com/bitwarden/browser
synced 2026-02-07 04:03:29 +00:00
committed by
William Martin
parent
172623e050
commit
b42ecccb39
@@ -1,5 +1,5 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { Component, input } from "@angular/core";
|
||||
|
||||
type ProgressSizeType = "small" | "default" | "large";
|
||||
type BackgroundType = "danger" | "primary" | "success" | "warning";
|
||||
@@ -26,19 +26,19 @@ const BackgroundClasses: Record<BackgroundType, string[]> = {
|
||||
imports: [CommonModule],
|
||||
})
|
||||
export class ProgressComponent {
|
||||
@Input() barWidth = 0;
|
||||
@Input() bgColor: BackgroundType = "primary";
|
||||
@Input() showText = true;
|
||||
@Input() size: ProgressSizeType = "default";
|
||||
@Input() text?: string;
|
||||
readonly barWidth = input(0);
|
||||
readonly bgColor = input<BackgroundType>("primary");
|
||||
readonly showText = input(true);
|
||||
readonly size = input<ProgressSizeType>("default");
|
||||
readonly text = input<string>(undefined);
|
||||
|
||||
get displayText() {
|
||||
return this.showText && this.size !== "small";
|
||||
return this.showText() && this.size() !== "small";
|
||||
}
|
||||
|
||||
get outerBarStyles() {
|
||||
return ["tw-overflow-hidden", "tw-rounded", "tw-bg-secondary-100"].concat(
|
||||
SizeClasses[this.size],
|
||||
SizeClasses[this.size()],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ export class ProgressComponent {
|
||||
"tw-text-contrast",
|
||||
"tw-transition-all",
|
||||
]
|
||||
.concat(SizeClasses[this.size])
|
||||
.concat(BackgroundClasses[this.bgColor]);
|
||||
.concat(SizeClasses[this.size()])
|
||||
.concat(BackgroundClasses[this.bgColor()]);
|
||||
}
|
||||
|
||||
get textContent() {
|
||||
return this.text || this.barWidth + "%";
|
||||
return this.text() || this.barWidth() + "%";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user