You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.4 KiB

  1. import ImmutablePropTypes from 'react-immutable-proptypes';
  2. import Avatar from './avatar';
  3. import RelativeTimestamp from './relative_timestamp';
  4. import PureRenderMixin from 'react-addons-pure-render-mixin';
  5. import IconButton from './icon_button';
  6. const Status = React.createClass({
  7. propTypes: {
  8. status: ImmutablePropTypes.map.isRequired,
  9. onReply: React.PropTypes.func
  10. },
  11. mixins: [PureRenderMixin],
  12. handleReplyClick () {
  13. this.props.onReply(this.props.status);
  14. },
  15. render () {
  16. var content = { __html: this.props.status.get('content') };
  17. var status = this.props.status;
  18. return (
  19. <div style={{ padding: '8px 10px', paddingLeft: '68px', position: 'relative', minHeight: '48px', borderBottom: '1px solid #363c4b', cursor: 'pointer' }}>
  20. <div style={{ fontSize: '15px' }}>
  21. <div style={{ float: 'right', fontSize: '14px' }}>
  22. <a href={status.get('url')} className='status__relative-time' style={{ color: '#616b86' }}><RelativeTimestamp timestamp={status.get('created_at')} /></a>
  23. </div>
  24. <a href={status.getIn(['account', 'url'])} className='status__display-name' style={{ display: 'block', maxWidth: '100%', paddingRight: '25px', color: '#616b86' }}>
  25. <div style={{ position: 'absolute', left: '10px', top: '10px', width: '48px', height: '48px' }}>
  26. <Avatar src={status.getIn(['account', 'avatar'])} size={48} />
  27. </div>
  28. <span style={{ display: 'block', maxWidth: '100%', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>
  29. <strong style={{ fontWeight: 'bold', color: '#fff' }}>{status.getIn(['account', 'display_name'])}</strong> <span style={{ fontSize: '14px' }}>@{status.getIn(['account', 'acct'])}</span>
  30. </span>
  31. </a>
  32. </div>
  33. <div className='status__content' dangerouslySetInnerHTML={content} />
  34. <div style={{ marginTop: '10px', overflow: 'hidden' }}>
  35. <div style={{ float: 'left', marginRight: '10px'}}><IconButton title='Reply' icon='reply' onClick={this.handleReplyClick} /></div>
  36. <div style={{ float: 'left', marginRight: '10px'}}><IconButton title='Reblog' icon='retweet' /></div>
  37. <div style={{ float: 'left'}}><IconButton title='Favourite' icon='star' /></div>
  38. </div>
  39. </div>
  40. );
  41. }
  42. });
  43. export default Status;