Skip to content

Instantly share code, notes, and snippets.

@natew
Last active August 29, 2015 14:18
Show Gist options
  • Save natew/0072ca690f379d175f9f to your computer and use it in GitHub Desktop.
Save natew/0072ca690f379d175f9f to your computer and use it in GitHub Desktop.
coffeescript 2.0
import React, Reapp, View, NestedViewList, List from 'reapp'
import RefreshButton, RotatingLoadingIcon, ArticleItem
Article
@state = { refreshing: false }
mount
:articlesHotLoad
refresh
:articlesHotRefresh <> @state.refreshing
load
:articlesHotLoadMore <> @state.refreshing
render
articles = @hotArticles
article = @[email protected]
NestedViewList @props.viewListProps
View title="Hot Articles" titleRight=<RefreshButton onTap=@handleRefresh [email protected] />
if articles
<div style=styles.iconContainer>
<RotatingLoadingIcon />
</div>
else
List
articles.map(article, i =>
ArticleItem article=store.getIn(['articles', article, 'data'])
List.Item styles=styles.loadMore onTap=@handleLoadMore
Load More
props.child({ article })
styles =
iconContainer:
padding: 20
marginLeft: -10
loadMore:
content:
textAlign: 'center'
padding: 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment