Skip to content

Commit

Permalink
page placeholder component
Browse files Browse the repository at this point in the history
  • Loading branch information
awmleer committed Oct 15, 2018
1 parent 1413f7a commit 8e1485c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 27 deletions.
11 changes: 9 additions & 2 deletions src/components/components.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { NgModule } from '@angular/core';
import { SearchBoxComponent } from './search-box/search-box';
import {IonicModule} from "ionic-angular";
import { PagePlaceholderComponent } from './page-placeholder/page-placeholder';

@NgModule({
declarations: [SearchBoxComponent],
declarations: [
SearchBoxComponent,
PagePlaceholderComponent,
],
imports: [
IonicModule,
],
exports: [SearchBoxComponent]
exports: [
SearchBoxComponent,
PagePlaceholderComponent,
]
})
export class ComponentsModule {}
4 changes: 4 additions & 0 deletions src/components/page-placeholder/page-placeholder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="placeholder">
<ion-icon [name]="icon"></ion-icon>
{{text}}
</div>
13 changes: 13 additions & 0 deletions src/components/page-placeholder/page-placeholder.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
page-placeholder {
div.placeholder{
width:100%;
text-align: center;
padding-top: 20vh;
color: #797979;
ion-icon{
font-size: 80px;
display: block;
margin-bottom: 40px;
}
}
}
16 changes: 16 additions & 0 deletions src/components/page-placeholder/page-placeholder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {Component, Input} from '@angular/core';


@Component({
selector: 'page-placeholder',
templateUrl: 'page-placeholder.html'
})
export class PagePlaceholderComponent {

@Input() icon: string;
@Input() text: string;

constructor() {
}

}
19 changes: 3 additions & 16 deletions src/pages/collection/collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,15 @@ <h2>
</span>
</a>
</div>
<div *ngIf="collections.length==0" class="placeholder">
<ion-icon name="ios-folder-open-outline"></ion-icon>
<br><br>
收藏夹空空如也
</div>
<page-placeholder *ngIf="collections.length==0" icon="ios-folder-open-outline" text="收藏夹空空如也"></page-placeholder>
</ng-container>
<ng-container *ngIf="collections === null">
<!--TODO separate this to ListPlaceholderComponent-->
<div class="placeholder">
<ion-icon name="ios-radio-outline"></ion-icon>
<br><br>
加载中
</div>
<page-placeholder icon="ios-radio-outline" text="加载中"></page-placeholder>
</ng-container>
</ng-container>

<ng-container *ngIf="!accountSvc.user">
<div class="placeholder">
<ion-icon name="ios-cloud-circle-outline"></ion-icon>
<br><br>
登录后查看收藏夹
</div>
<page-placeholder icon="ios-cloud-circle-outline" text="登录后查看收藏夹"></page-placeholder>
</ng-container>

</ion-content>
9 changes: 0 additions & 9 deletions src/pages/collection/collection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,4 @@ page-collection {
color: #8b8b8b;
}
}
div.placeholder{
width:100%;
text-align: center;
padding-top: 20vh;
color: #797979;
ion-icon{
font-size: 80px;
}
}
}

0 comments on commit 8e1485c

Please sign in to comment.