-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
bfd4bd8
commit 260114b
Showing
12 changed files
with
483 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 './skeleton'; |
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,33 @@ | ||
.p-skeleton { | ||
position: relative; | ||
overflow: hidden; | ||
} | ||
|
||
.p-skeleton::after { | ||
content: ""; | ||
animation: p-skeleton-animation 1.2s infinite; | ||
height: 100%; | ||
left: 0; | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
transform: translateX(-100%); | ||
z-index: 1; | ||
} | ||
|
||
.p-skeleton-circle { | ||
border-radius: 50%; | ||
} | ||
|
||
.p-skeleton-none::after { | ||
animation: none; | ||
} | ||
|
||
@keyframes p-skeleton-animation { | ||
from { | ||
transform: translateX(-100%); | ||
} | ||
to { | ||
transform: translateX(100%); | ||
} | ||
} |
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 { Skeleton, SkeletonModule } from './skeleton'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
describe('Skeleton', () => { | ||
|
||
let tag: Skeleton; | ||
let fixture: ComponentFixture<Skeleton>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
NoopAnimationsModule | ||
], | ||
declarations: [ | ||
SkeletonModule | ||
] | ||
}); | ||
|
||
fixture = TestBed.createComponent(Skeleton); | ||
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,53 @@ | ||
import { NgModule, Component, ChangeDetectionStrategy, ViewEncapsulation, Input} from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
@Component({ | ||
selector: 'p-skeleton', | ||
template: ` | ||
<div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="containerStyle()"> | ||
</div> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
encapsulation: ViewEncapsulation.None, | ||
styleUrls: ['./skeleton.css'] | ||
}) | ||
export class Skeleton { | ||
|
||
@Input() styleClass: string; | ||
|
||
@Input() style: any; | ||
|
||
@Input() shape: string = "rectangle"; | ||
|
||
@Input() animation: string = "wave"; | ||
|
||
@Input() borderRadius: string = null; | ||
|
||
@Input() size: string = null; | ||
|
||
@Input() width: string = "100%"; | ||
|
||
@Input() height: string = "1rem"; | ||
|
||
containerClass() { | ||
return { | ||
'p-skeleton p-component': true, | ||
'p-skeleton-circle': this.shape === 'circle', | ||
'p-skeleton-animation-none': this.animation === 'none' | ||
}; | ||
} | ||
|
||
containerStyle() { | ||
if (this.size) | ||
return {...this.style, width: this.size, height: this.size, borderRadius: this.borderRadius}; | ||
else | ||
return {...this.style, width: this.width, height: this.height, borderRadius: this.borderRadius}; | ||
} | ||
} | ||
|
||
@NgModule({ | ||
imports: [CommonModule], | ||
exports: [Skeleton], | ||
declarations: [Skeleton] | ||
}) | ||
export class SkeletonModule { } |
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
15 changes: 15 additions & 0 deletions
15
src/app/showcase/components/skeleton/skeletondemo-routing.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,15 @@ | ||
import {NgModule} from '@angular/core'; | ||
import {RouterModule} from '@angular/router' | ||
import {SkeletonDemo} from './skeletondemo'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild([ | ||
{path:'',component: SkeletonDemo} | ||
]) | ||
], | ||
exports: [ | ||
RouterModule | ||
] | ||
}) | ||
export class SkeletonDemoRoutingModule {} |
Oops, something went wrong.