1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-10 12:24:20 +01:00
ipfs-boards/webapp/components/post.jsx
2015-11-20 20:21:54 +01:00

31 lines
948 B
JavaScript

var React = require('react')
var moment = require('moment')
var Markdown = require('markdown.jsx')
var Icon = require('icon.jsx')
module.exports = function(boards){
var UserID = require('userID.jsx')(boards)
return React.createClass({
getDate: function(){
if(this.props.post.date){
return moment.unix(this.props.post.date).fromNow()
} else {
return 'Unknown Date'
}
},
render: function(){
return <div key={this.props.post.title} className="post">
<div className="content">
<h5>{this.props.post.title}</h5><hr/>
<Markdown source={this.props.post.text} skipHtml={true} /><hr/>
<div className="icons">
<UserID id={this.props.post.op}></UserID>
<Icon name="clock-o" className="not-first"/> {this.getDate()}
<Icon name="comments" className="not-first" /> Comments
</div>
</div>
</div>
}
})
}