More styling for statuses

This commit is contained in:
Eugen Rochko
2016-08-24 21:08:00 +02:00
parent bc0692d75b
commit a541e937ca
11 changed files with 135 additions and 379 deletions

View File

@@ -0,0 +1,55 @@
import moment from 'moment';
moment.updateLocale('en', {
relativeTime : {
future: "in %s",
past: "%s ago",
s: "s",
m: "a minute",
mm: "%dm",
h: "an hour",
hh: "%dh",
d: "a day",
dd: "%dd",
M: "a month",
MM: "%dm",
y: "a year",
yy: "%dy"
}
});
const RelativeTimestamp = React.createClass({
getInitialState () {
return {
text: ''
};
},
propTypes: {
timestamp: React.PropTypes.string.isRequired
},
componentWillMount () {
this._updateMomentText();
this.interval = setInterval(this._updateMomentText, 6000);
},
componentWillUnmount () {
clearInterval(this.interval);
},
_updateMomentText () {
this.setState({ text: moment(this.props.timestamp).fromNow() });
},
render () {
return (
<span style={{ color: '#616b86' }}>
{this.state.text}
</span>
);
}
});
export default RelativeTimestamp;