-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: optimized progress button and bar components
- Loading branch information
1 parent
a83d30f
commit b9f1454
Showing
6 changed files
with
29 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...design-angular-kit/src/lib/components/core/progress-button/progress-button.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<ng-content></ng-content> | ||
|
||
<it-progress-bar *ngIf="isProgress" | ||
[value]="progress||0" | ||
[indeterminate]="indeterminate" | ||
[value]="progressValue" | ||
[indeterminate]="isIndeterminate" | ||
[color]="progressColor"></it-progress-bar> |
27 changes: 15 additions & 12 deletions
27
...s/design-angular-kit/src/lib/components/core/progress-button/progress-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { BooleanInput, isTrueBooleanInput } from '../../../utils/boolean-input'; | ||
import { ProgressBarColor } from '../../../interfaces/core'; | ||
|
||
@Component({ | ||
selector: 'button[itButton][progress]', | ||
templateUrl: './progress-button.component.html', | ||
styleUrls: ['./progress-button.component.scss'] | ||
styleUrls: ['./progress-button.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ProgressButtonComponent { | ||
|
||
/** | ||
* The progress bar value [0, 100] | ||
* @default null | ||
* Behavior of the progress bar | ||
* - <b>true</b>: Show indeterminate progress bar | ||
* - <b>false</b> or <b>undefined</b>: Hide progress bar | ||
* - <b>number</b> [0, 100]: Assign a specific value to the progress bar | ||
* @default undefined | ||
*/ | ||
@Input() progress?: number | null = null; | ||
|
||
/** | ||
* Show the progress as indeterminate | ||
*/ | ||
@Input() indeterminate?: BooleanInput; | ||
@Input() progress?: number | BooleanInput; | ||
|
||
/** | ||
* The progress bar color | ||
*/ | ||
@Input() progressColor?: ProgressBarColor; | ||
|
||
get isProgress(): boolean { | ||
return (this.progress !== null && this.progress !== undefined) || this.isIndeterminate; | ||
return typeof this.progress === 'number' || isTrueBooleanInput(this.progress); | ||
} | ||
|
||
get progressValue(): number { | ||
return typeof this.progress === 'number' ? this.progress : 0; | ||
} | ||
|
||
get isIndeterminate(): boolean { | ||
return isTrueBooleanInput(this.indeterminate); | ||
return typeof this.progress !== 'number' && isTrueBooleanInput(this.progress); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b9f1454
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
design-angular-kit – ./
design-angular-kit.vercel.app
design-angular-kit-git-main-dip-trasformazione-digitale.vercel.app
design-angular-kit-dip-trasformazione-digitale.vercel.app