Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(progressbar): allow to specify progressbar text type (#3394)
As advised on the Bootstrap documentation page when using some background variants that is advisable to change the text color accordingly, for example for readability purposes. The `textType` input property allows to achieve this, adding support for binding text types to `text-*` utility class on the progress bar. Common scenario: progress bar with 'warning' type renders a white text on the yellow background (assuming default BS). This change allows users to opt to 'dark' text type to improve the readability. ref: https://getbootstrap.com/docs/4.3/utilities/colors/#background-color
- Loading branch information
1 parent
25df51a
commit 1057dbd
Showing
8 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
demo/src/app/components/progressbar/demos/texttypes/progressbar-texttypes.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<p><ngb-progressbar type="success" textType="white" [value]="25" showValue="true"></ngb-progressbar></p> | ||
<p><ngb-progressbar type="dark" textType="white" [value]="50" showValue="true"></ngb-progressbar></p> | ||
<p><ngb-progressbar type="light" textType="success" [value]="75" showValue="true"></ngb-progressbar></p> | ||
<p><ngb-progressbar type="warning" textType="dark" [value]="100" showValue="true"></ngb-progressbar></p> |
13 changes: 13 additions & 0 deletions
13
demo/src/app/components/progressbar/demos/texttypes/progressbar-texttypes.module.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
import { NgbdProgressbarTextTypes } from './progressbar-texttypes'; | ||
|
||
@NgModule({ | ||
imports: [BrowserModule, NgbModule], | ||
declarations: [NgbdProgressbarTextTypes], | ||
exports: [NgbdProgressbarTextTypes], | ||
bootstrap: [NgbdProgressbarTextTypes] | ||
}) | ||
export class NgbdProgressbarTextTypesModule {} |
8 changes: 8 additions & 0 deletions
8
demo/src/app/components/progressbar/demos/texttypes/progressbar-texttypes.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'ngbd-progressbar-texttypes', | ||
templateUrl: './progressbar-texttypes.html' | ||
}) | ||
export class NgbdProgressbarTextTypes { | ||
} |
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
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
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