mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
[AC-1423] Add minWidth input to bit-progress component
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
aria-valuemin="0"
|
aria-valuemin="0"
|
||||||
aria-valuemax="100"
|
aria-valuemax="100"
|
||||||
attr.aria-valuenow="{{ barWidth }}"
|
attr.aria-valuenow="{{ barWidth }}"
|
||||||
[ngStyle]="{ width: barWidth + '%' }"
|
[ngStyle]="{ width: barWidthPercentage + '%' }"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
*ngIf="displayText"
|
*ngIf="displayText"
|
||||||
|
|||||||
@@ -26,11 +26,16 @@ export class ProgressComponent {
|
|||||||
@Input() showText = true;
|
@Input() showText = true;
|
||||||
@Input() size: SizeTypes = "default";
|
@Input() size: SizeTypes = "default";
|
||||||
@Input() text?: string;
|
@Input() text?: string;
|
||||||
|
@Input() minWidth = 0;
|
||||||
|
|
||||||
get displayText() {
|
get displayText() {
|
||||||
return this.showText && this.size !== "small";
|
return this.showText && this.size !== "small";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected get barWidthPercentage() {
|
||||||
|
return this.barWidth > this.minWidth ? this.barWidth : this.minWidth;
|
||||||
|
}
|
||||||
|
|
||||||
get outerBarStyles() {
|
get outerBarStyles() {
|
||||||
return ["tw-overflow-hidden", "tw-rounded", "tw-bg-secondary-100"].concat(
|
return ["tw-overflow-hidden", "tw-rounded", "tw-bg-secondary-100"].concat(
|
||||||
SizeClasses[this.size]
|
SizeClasses[this.size]
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export default {
|
|||||||
showText: true,
|
showText: true,
|
||||||
size: "default",
|
size: "default",
|
||||||
bgColor: "primary",
|
bgColor: "primary",
|
||||||
|
minWidth: 0,
|
||||||
},
|
},
|
||||||
} as Meta;
|
} as Meta;
|
||||||
|
|
||||||
@@ -38,3 +39,10 @@ export const CustomText: Story = {
|
|||||||
text: "Loading...",
|
text: "Loading...",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MinWidth: Story = {
|
||||||
|
args: {
|
||||||
|
barWidth: 0,
|
||||||
|
minWidth: 5,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user