-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c15c2d
commit 05ca73b
Showing
11 changed files
with
342 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "ng-packagr/ng-package.schema.json", | ||
"lib": { | ||
"entryFile": "public_api.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 @@ | ||
export * from './tag'; |
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,15 @@ | ||
.p-tag { | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.p-tag-icon, | ||
.p-tag-value, | ||
.p-tag-icon.pi { | ||
line-height: 1.5; | ||
} | ||
|
||
.p-tag.p-tag-rounded { | ||
border-radius: 10rem; | ||
} |
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,23 @@ | ||
import { TestBed, ComponentFixture } from '@angular/core/testing'; | ||
import { Tag, TagModule } from './tag'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
describe('Tag', () => { | ||
|
||
let tag: Tag; | ||
let fixture: ComponentFixture<Tag>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
NoopAnimationsModule | ||
], | ||
declarations: [ | ||
TagModule | ||
] | ||
}); | ||
|
||
fixture = TestBed.createComponent(Tag); | ||
tag = fixture.componentInstance; | ||
}); | ||
}); |
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,49 @@ | ||
import { NgModule, Component, ChangeDetectionStrategy, ViewEncapsulation, Input} from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
@Component({ | ||
selector: 'p-tag', | ||
template: ` | ||
<span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style"> | ||
<ng-content></ng-content> | ||
<span class="p-tag-icon" [ngClass]="icon" *ngIf="icon"></span> | ||
<span class="p-tag-value">{{value}}</span> | ||
</span> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
encapsulation: ViewEncapsulation.None, | ||
styleUrls: ['./tag.css'] | ||
}) | ||
export class Tag { | ||
|
||
@Input() styleClass: string; | ||
|
||
@Input() style: any; | ||
|
||
@Input() severity: string; | ||
|
||
@Input() value: string; | ||
|
||
@Input() icon: string; | ||
|
||
@Input() rounded: boolean; | ||
|
||
|
||
containerClass() { | ||
return { | ||
'p-tag p-component': true, | ||
'p-tag-info': this.severity === 'info', | ||
'p-tag-success': this.severity === 'success', | ||
'p-tag-warning': this.severity === 'warning', | ||
'p-tag-danger': this.severity === 'danger', | ||
'p-tag-rounded': this.rounded | ||
}; | ||
} | ||
} | ||
|
||
@NgModule({ | ||
imports: [CommonModule], | ||
exports: [Tag], | ||
declarations: [Tag] | ||
}) | ||
export class TagModule { } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {NgModule} from '@angular/core'; | ||
import {RouterModule} from '@angular/router' | ||
import {TagDemo} from './tagdemo'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild([ | ||
{path:'',component: TagDemo} | ||
]) | ||
], | ||
exports: [ | ||
RouterModule | ||
] | ||
}) | ||
export class TagDemoRoutingModule {} |
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,199 @@ | ||
<div class="content-section introduction"> | ||
<div class="feature-intro"> | ||
<h1>Tag</h1> | ||
<p>Tag component is used to categorize content.</p> | ||
</div> | ||
</div> | ||
|
||
<div class="content-section implementation"> | ||
<div class="card"> | ||
<h5>Tags</h5> | ||
<p-tag styleClass="p-mr-2" value="Primary"></p-tag> | ||
<p-tag styleClass="p-mr-2" severity="success" value="Success"></p-tag> | ||
<p-tag styleClass="p-mr-2" severity="info" value="Info"></p-tag> | ||
<p-tag styleClass="p-mr-2" severity="warning" value="Warning"></p-tag> | ||
<p-tag severity="danger" value="Danger"></p-tag> | ||
|
||
<h5>Pills</h5> | ||
<p-tag styleClass="p-mr-2" value="Primary" [rounded]="true"></p-tag> | ||
<p-tag styleClass="p-mr-2" severity="success" value="Success" [rounded]="true"></p-tag> | ||
<p-tag styleClass="p-mr-2" severity="info" value="Info" [rounded]="true"></p-tag> | ||
<p-tag styleClass="p-mr-2" severity="warning" value="Warning" [rounded]="true"></p-tag> | ||
<p-tag severity="danger" value="Danger" [rounded]="true"></p-tag> | ||
|
||
<h5>Icons</h5> | ||
<p-tag styleClass="p-mr-2" icon="pi pi-user" value="Primary"></p-tag> | ||
<p-tag styleClass="p-mr-2" icon="pi pi-check" severity="success" value="Success"></p-tag> | ||
<p-tag styleClass="p-mr-2" icon="pi pi-info-circle" severity="info" value="Info"></p-tag> | ||
<p-tag styleClass="p-mr-2" con="pi pi-exclamation-triangle" severity="warning" value="Warning"></p-tag> | ||
<p-tag icon="pi pi-times" severity="danger" value="Danger"></p-tag> | ||
</div> | ||
</div> | ||
|
||
<div class="content-section documentation"> | ||
<p-tabView> | ||
<p-tabPanel header="Documentation"> | ||
<h5>Getting Started</h5> | ||
<p>Content of the badge is specified using the <i>value</i> property.</p> | ||
|
||
<h5>Positioning</h5> | ||
<p>A badge can easily be positioned relative to another element by wrapping it.</p> | ||
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces> | ||
<p-badge [value]="2"></p-badge> | ||
</app-code> | ||
|
||
<h5>Tags</h5> | ||
<p>Tags are optimized for text rather than number and used with the <i>.p-tag</i> class. For more rounded styling like pills, add the <i>.p-tag-rounded</i> class</p> | ||
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces> | ||
<span class="p-tag">New</span> | ||
<span class="p-tag p-tag-rounded">New</span> | ||
</app-code> | ||
|
||
<h5>Severities</h5> | ||
<p>Different options are available as severity levels with.</p> | ||
|
||
<ul> | ||
<li>.p-badge-secondary</li> | ||
<li>.p-badge-success</li> | ||
<li>.p-badge-info</li> | ||
<li>.p-badge-warning</li> | ||
<li>.p-badge-danger</li> | ||
</ul> | ||
|
||
<h5>Positoning</h5> | ||
<p>A badge can easily be positioned relative to another element when both are wrapped inside an element with <i>p-overlay-badge</i> class.</p> | ||
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces> | ||
<span class="p-overlay-badge"> | ||
<i class="pi pi-bell" style="font-size: 2em"></i> | ||
<span class="p-badge">2</span> | ||
</span> | ||
|
||
<span class="p-overlay-badge"> | ||
<p-button label="New"></p-button> | ||
<span class="p-badge p-badge-warning">5</span> | ||
</span> | ||
</app-code> | ||
|
||
<h5>Inline Button Badges</h5> | ||
<p>Buttons provide integrated badge support with the <i>badge</i> and <i>badgeClass</i> properties.</p> | ||
|
||
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces> | ||
<p-button label="Emails" badge="8"></p-button> | ||
<p-button label="Messages" icon="pi pi-users" styleClass="p-button-warning" badge="8" badgeClass="p-badge-danger"></p-button> | ||
</app-code> | ||
|
||
<h5>Sizes</h5> | ||
<p>Badge sizes are adjusted with additional classes.</p> | ||
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces> | ||
<span class="p-badge">2</span> | ||
<span class="p-badge p-badge-l p-badge-sucess">4</span> | ||
<span class="p-badge p-badge-xl p-badge-warning">6</span> | ||
</app-code> | ||
|
||
<p>In addition, when placed inside another element, badge sizes can also derive their size from their parent.</p> | ||
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces> | ||
<h1>Heading 1 <span class="p-tag p-tag-success">New</span></h1> | ||
<h2>Heading 2 <span class="p-tag p-tag-success">New</span></h2> | ||
</app-code> | ||
|
||
<h5>Styling</h5> | ||
<p>Following is the list of structural style classes, for theming classes visit <a href="#" [routerLink]="['/theming']">theming</a> page.</p> | ||
<div class="doc-tablewrapper"> | ||
<table class="doc-table"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Element</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>p-badge</td> | ||
<td>Badge element</td> | ||
</tr> | ||
<tr> | ||
<td>p-tag</td> | ||
<td>Tag element</td> | ||
</tr> | ||
<tr> | ||
<td>p-tag-rounded</td> | ||
<td>Rounded tag element</td> | ||
</tr> | ||
<tr> | ||
<td>p-overlay-badge</td> | ||
<td>Wrapper of a badge and its target.</td> | ||
</tr> | ||
<tr> | ||
<td>p-badge-lg</td> | ||
<td>Large badge element</td> | ||
</tr> | ||
<tr> | ||
<td>p-badge-xl</td> | ||
<td>Extra large badge element</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<h5>Dependencies</h5> | ||
<p>None.</p> | ||
</p-tabPanel> | ||
|
||
<p-tabPanel header="Source"> | ||
<a href="https://github.com/primefaces/primeng/tree/master/src/app/showcase/components/badge" class="btn-viewsource" target="_blank"> | ||
<span>View on GitHub</span> | ||
</a> | ||
|
||
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces> | ||
<h5>Numbers</h5> | ||
<div class="badges"> | ||
<span class="p-badge">2</span> | ||
<span class="p-badge p-badge-success">8</span> | ||
<span class="p-badge p-badge-info">4</span> | ||
<span class="p-badge p-badge-warning">12</span> | ||
<span class="p-badge p-badge-danger">3</span> | ||
</div> | ||
|
||
<h5>Tags</h5> | ||
<div class="badges"> | ||
<span class="p-tag">Primary</span> | ||
<span class="p-tag p-tag-success">Success</span> | ||
<span class="p-tag p-tag-info">Info</span> | ||
<span class="p-tag p-tag-warning">Warning</span> | ||
<span class="p-tag p-tag-danger">Danger</span> | ||
</div> | ||
|
||
<h5>Pills</h5> | ||
<div class="badges"> | ||
<span class="p-tag p-tag-rounded">Primary</span> | ||
<span class="p-tag p-tag-rounded p-tag-success">Success</span> | ||
<span class="p-tag p-tag-rounded p-tag-info">Info</span> | ||
<span class="p-tag p-tag-rounded p-tag-warning">Warning</span> | ||
<span class="p-tag p-tag-rounded p-tag-danger">Danger</span> | ||
</div> | ||
|
||
<h5>Positioned Badge</h5> | ||
<span class="p-overlay-badge p-mr-5"> | ||
<i class="pi pi-bell" style="font-size: 2em"></i> | ||
<span class="p-badge">2</span> | ||
</span> | ||
|
||
<span class="p-overlay-badge"> | ||
<p-button label="New"></p-button> | ||
<span class="p-badge p-badge-warning">5</span> | ||
</span> | ||
|
||
<h5>Inline Button Badge</h5> | ||
<p-button label="Emails" badge="8" styleClass="p-mr-2" ></p-button> | ||
<p-button label="Messages" icon="pi pi-users" styleClass="p-button-warning" badge="8" badgeClass="p-badge-danger" ></p-button> | ||
|
||
<h5>Sizes</h5> | ||
<div class="badges"> | ||
<span class="p-badge">2</span> | ||
<span class="p-badge p-badge-lg p-badge-sucess">4</span> | ||
<span class="p-badge p-badge-xl p-badge-warning">6</span> | ||
</div> | ||
</app-code> | ||
</p-tabPanel> | ||
</p-tabView> | ||
</div> |
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,25 @@ | ||
import {NgModule} from '@angular/core'; | ||
import {CommonModule} from '@angular/common'; | ||
import {TagDemo} from './tagdemo'; | ||
import {TagDemoRoutingModule} from './tagdemo-routing.module'; | ||
import {ButtonModule} from 'primeng/button'; | ||
import {PanelModule} from 'primeng/panel'; | ||
import {TabViewModule} from 'primeng/tabview'; | ||
import {AppCodeModule} from '../../app.code.component'; | ||
import { TagModule } from 'primeng/tag'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
TagDemoRoutingModule, | ||
ButtonModule, | ||
PanelModule, | ||
TabViewModule, | ||
TagModule, | ||
AppCodeModule | ||
], | ||
declarations: [ | ||
TagDemo | ||
] | ||
}) | ||
export class TagDemoModule {} |
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,7 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
templateUrl: './tagdemo.html' | ||
}) | ||
export class TagDemo { | ||
} |