forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:skeleton):add skeleton component (NG-ZORRO#1829)
* feat(module:skeleton): add skeleton component * fix(component:skeleton):sync demo to antd
- Loading branch information
Showing
25 changed files
with
766 additions
and
25 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
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,13 @@ | ||
--- | ||
order: 2 | ||
title: | ||
zh-CN: 动画效果 | ||
en-US: Active Animation | ||
--- | ||
## zh-CN | ||
|
||
显示动画效果。 | ||
|
||
## en-US | ||
|
||
Display active animation. |
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,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-skeleton-active', | ||
template: ` | ||
<nz-skeleton [nzActive]="true"></nz-skeleton> | ||
` | ||
}) | ||
export class NzDemoSkeletonActiveComponent { } |
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,14 @@ | ||
--- | ||
order: 0 | ||
title: | ||
zh-CN: 基本 | ||
en-US: Basic | ||
--- | ||
|
||
## zh-CN | ||
|
||
最简单的用法。 | ||
|
||
## en-US | ||
|
||
Basic usage. |
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,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-skeleton-basic', | ||
template: ` | ||
<nz-skeleton></nz-skeleton> | ||
` | ||
}) | ||
export class NzDemoSkeletonBasicComponent { } |
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,14 @@ | ||
--- | ||
order: 3 | ||
title: | ||
zh-CN: 包含子组件 | ||
en-US: Contains sub component | ||
--- | ||
|
||
## zh-CN | ||
|
||
加载占位图包含子组件。 | ||
|
||
## en-US | ||
|
||
Skeleton contains sub component. |
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,36 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-skeleton-children', | ||
template: ` | ||
<div class="article"> | ||
<nz-skeleton [nzLoading]="loading"> | ||
<h4>Ant Design, a design language</h4> | ||
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.</p> | ||
</nz-skeleton> | ||
<button nz-button (click)="showSkeleton()" [disabled]="loading"> | ||
Show Skeleton | ||
</button> | ||
</div> | ||
`, | ||
styles : [ | ||
` | ||
.article h4 { | ||
margin-bottom: 16px; | ||
} | ||
.article button { | ||
margin-top: 16px; | ||
} | ||
` | ||
] | ||
}) | ||
export class NzDemoSkeletonChildrenComponent { | ||
loading = false; | ||
|
||
showSkeleton(): void { | ||
this.loading = true; | ||
setTimeout(() => { | ||
this.loading = false; | ||
}, 3000); | ||
} | ||
} |
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,14 @@ | ||
--- | ||
order: 1 | ||
title: | ||
zh-CN: 复杂的组合 | ||
en-US: Complex combination | ||
--- | ||
|
||
## zh-CN | ||
|
||
更复杂的组合。 | ||
|
||
## en-US | ||
|
||
Complex combination with avatar and multiple paragraphs. |
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,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-skeleton-complex', | ||
template: ` | ||
<nz-skeleton [nzAvatar]="true" [nzParagraph]="{ rows: 4 }"></nz-skeleton> | ||
` | ||
}) | ||
export class NzDemoSkeletonComplexComponent { } |
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,14 @@ | ||
--- | ||
order: 4 | ||
title: | ||
zh-CN: 列表样例 | ||
en-US: List Sample | ||
--- | ||
|
||
## zh-CN | ||
|
||
在列表组件中使用加载占位符。 | ||
|
||
## en-US | ||
|
||
Use skeleton in list component. |
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,40 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-skeleton-list', | ||
template: ` | ||
<nz-switch [(ngModel)]="loading"></nz-switch> | ||
<nz-list [nzDataSource]="listData" [nzRenderItem]="item" [nzItemLayout]="'vertical'"> | ||
<ng-template #item let-item> | ||
<nz-list-item [nzContent]="loading?' ':item.content" [nzActions]="loading?[]:[starAction,likeAction,msgAction]" [nzExtra]="loading?'':extra"> | ||
<nz-skeleton [nzLoading]="loading" [nzActive]="true" [nzAvatar]="true"> | ||
<ng-template #starAction><i class="anticon anticon-star-o" style="margin-right: 8px;"></i> 156</ng-template> | ||
<ng-template #likeAction><i class="anticon anticon-like-o" style="margin-right: 8px;"></i> 156</ng-template> | ||
<ng-template #msgAction><i class="anticon anticon-message" style="margin-right: 8px;"></i> 2</ng-template> | ||
<nz-list-item-meta | ||
[nzAvatar]="item.avatar" | ||
[nzTitle]="nzTitle" | ||
[nzDescription]="item.description"> | ||
<ng-template #nzTitle><a href="{{item.href}}">{{item.title}}</a></ng-template> | ||
</nz-list-item-meta> | ||
<ng-template #extra> | ||
<img width="272" alt="logo" src="https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLcXyDKnZfES.png"> | ||
</ng-template> | ||
</nz-skeleton> | ||
</nz-list-item> | ||
</ng-template> | ||
</nz-list> | ||
` | ||
}) | ||
export class NzDemoSkeletonListComponent { | ||
loading = true; | ||
listData = new Array(3).fill({}).map((i, index) => { | ||
return { | ||
href: 'http://ng.ant.design', | ||
title: `ant design part ${index}`, | ||
avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', | ||
description: 'Ant Design, a design language for background applications, is refined by Ant UED Team.', | ||
content: 'We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.' | ||
}; | ||
}); | ||
} |
Oops, something went wrong.