-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(infiniteScroll): add infinite scroll
Closes #5415
- Loading branch information
1 parent
3784f47
commit 0480fa3
Showing
10 changed files
with
583 additions
and
10 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
48 changes: 48 additions & 0 deletions
48
ionic/components/infinite-scroll/infinite-scroll-content.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,48 @@ | ||
import {Component, Input} from 'angular2/core' | ||
import {NgIf} from 'angular2/common'; | ||
|
||
import {Config} from '../../config/config'; | ||
import {InfiniteScroll} from './infinite-scroll'; | ||
import {Spinner} from '../spinner/spinner'; | ||
|
||
|
||
/** | ||
* @private | ||
*/ | ||
@Component({ | ||
selector: 'ion-infinite-content', | ||
template: | ||
'<div class="infinite-loading">' + | ||
'<div class="infinite-loading-spinner" *ngIf="loadingSpinner">' + | ||
'<ion-spinner [name]="loadingSpinner"></ion-spinner>' + | ||
'</div>' + | ||
'<div class="infinite-loading-text" [innerHTML]="loadingText" *ngIf="loadingText"></div>' + | ||
'</div>', | ||
directives: [NgIf, Spinner], | ||
host: { | ||
'[attr.state]': 'inf.state' | ||
} | ||
}) | ||
export class InfiniteScrollContent { | ||
|
||
/** | ||
* @input {string} An animated SVG spinner that shows while loading. | ||
*/ | ||
@Input() loadingSpinner: string; | ||
|
||
/** | ||
* @input {string} Optional text to display while loading. | ||
*/ | ||
@Input() loadingText: string; | ||
|
||
constructor(private inf: InfiniteScroll, private _config: Config) {} | ||
|
||
/** | ||
* @private | ||
*/ | ||
ngOnInit() { | ||
if (!this.loadingSpinner) { | ||
this.loadingSpinner = this._config.get('infiniteLoadingSpinner', this._config.get('spinner', 'ios')); | ||
} | ||
} | ||
} |
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,44 @@ | ||
@import "../../globals.core"; | ||
|
||
// Infinite Scroll | ||
// -------------------------------------------------- | ||
|
||
$infinite-scroll-loading-margin: 0px 0px 32px 0px !default; | ||
$infinite-scroll-loading-color: #666 !default; | ||
$infinite-scroll-loading-text-margin: 4px 32px 0 32px !default; | ||
|
||
|
||
ion-infinite { | ||
display: block; | ||
width: 100%; | ||
} | ||
|
||
|
||
// Infinite Scroll Content | ||
// -------------------------------------------------- | ||
|
||
ion-infinite-content { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
height: 100%; | ||
text-align: center; | ||
} | ||
|
||
.infinite-loading { | ||
width: 100%; | ||
margin: $infinite-scroll-loading-margin; | ||
} | ||
|
||
.infinite-loading-text { | ||
margin: $infinite-scroll-loading-text-margin; | ||
color: $infinite-scroll-loading-color; | ||
} | ||
|
||
|
||
// Infinite Scroll Content States | ||
// -------------------------------------------------- | ||
|
||
ion-infinite-content[state=disabled] .infinite-loading { | ||
display: none; | ||
} |
Oops, something went wrong.