Created
March 2, 2016 06:45
-
-
Save sfroestl/9988193a2910e3515b74 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
class InfiniteScroll extends React.Component { | |
displayName: 'InfiniteScroll'; | |
renderLoadMore() { | |
return <button | |
className='button' | |
onClick={ this.onloadMore.bind(this) }> | |
Load more | |
</button>; | |
} | |
renderLoadingSpinner() { | |
return <button | |
className='button' | |
disabled={true} | |
> | |
<i className='icon-refresh icon-spin'></i> Loading… | |
</button>; | |
} | |
onloadMore() { | |
this.props.loadMore(); | |
} | |
render() { | |
return ( | |
<div> | |
{ this.props.children } | |
{ this.props.isLoading ? this.renderLoadingSpinner() : this.renderLoadMore() } | |
</div> | |
); | |
} | |
} | |
export default InfiniteScroll; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment