twister-react/jsx/common/Postboard.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-04-29 09:19:10 +00:00
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
2016-01-23 10:40:13 +00:00
var React = require('react');
2015-04-29 09:19:10 +00:00
2016-01-23 10:40:13 +00:00
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
2015-04-29 09:19:10 +00:00
var Post = require("../common/Post.js");
module.exports = Postboard = React.createClass({
render: function() {
2015-08-16 14:11:44 +00:00
var activeAccount = this.props.activeAccount;
2015-04-29 09:19:10 +00:00
var posts = this.props.data.map(function(post, index) {
return (
2015-08-16 14:11:44 +00:00
<Post post={post} key={post.postid} activeAccount={activeAccount}/>
2015-04-29 09:19:10 +00:00
);
});
2015-04-30 09:22:58 +00:00
if (this.props.loading) {
var spinner = (
<ListGroupItem><p className="text-center"><img src="img/bouncing_ball.gif"/></p></ListGroupItem>
);
} else {
var spinner = (<span/>);
}
2015-04-29 09:19:10 +00:00
return (
<ListGroup fill>
{this.props.header}
2015-04-30 09:22:58 +00:00
{spinner}
2016-01-23 13:34:16 +00:00
<ReactCSSTransitionGroup transitionName="item" transitionEnterTimeout={500} transitionLeaveTimeout={300}>
2015-04-29 09:19:10 +00:00
{posts}
</ReactCSSTransitionGroup>
</ListGroup>
);
}
});