The code powering m.abunchtell.com https://m.abunchtell.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

78 рядки
3.1 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. import DisplayName from './display_name';
  7. const Status = React.createClass({
  8. propTypes: {
  9. status: ImmutablePropTypes.map.isRequired,
  10. onReply: React.PropTypes.func,
  11. onFavourite: React.PropTypes.func,
  12. onReblog: React.PropTypes.func
  13. },
  14. mixins: [PureRenderMixin],
  15. handleReplyClick () {
  16. this.props.onReply(this.props.status);
  17. },
  18. handleFavouriteClick () {
  19. this.props.onFavourite(this.props.status);
  20. },
  21. handleReblogClick () {
  22. this.props.onReblog(this.props.status);
  23. },
  24. render () {
  25. var content = { __html: this.props.status.get('content') };
  26. var { status, ...other } = this.props;
  27. if (status.get('reblog') !== null) {
  28. return (
  29. <div style={{ cursor: 'pointer' }}>
  30. <div style={{ marginLeft: '68px', color: '#616b86', padding: '8px 0', paddingBottom: '2px', fontSize: '14px', position: 'relative' }}>
  31. <div style={{ position: 'absolute', 'left': '-26px'}}><i className='fa fa-fw fa-retweet'></i></div>
  32. <a href={status.getIn(['account', 'url'])} className='status__display-name'><strong style={{ color: '#616b86'}}>{status.getIn(['account', 'display_name'])}</strong></a> reblogged
  33. </div>
  34. <Status {...other} status={status.get('reblog')} />
  35. </div>
  36. );
  37. }
  38. return (
  39. <div style={{ padding: '8px 10px', paddingLeft: '68px', position: 'relative', minHeight: '48px', borderBottom: '1px solid #363c4b', cursor: 'pointer' }}>
  40. <div style={{ fontSize: '15px' }}>
  41. <div style={{ float: 'right', fontSize: '14px' }}>
  42. <a href={status.get('url')} className='status__relative-time' style={{ color: '#616b86' }}><RelativeTimestamp timestamp={status.get('created_at')} /></a>
  43. </div>
  44. <a href={status.getIn(['account', 'url'])} className='status__display-name' style={{ display: 'block', maxWidth: '100%', paddingRight: '25px', color: '#616b86' }}>
  45. <div style={{ position: 'absolute', left: '10px', top: '10px', width: '48px', height: '48px' }}>
  46. <Avatar src={status.getIn(['account', 'avatar'])} size={48} />
  47. </div>
  48. <DisplayName account={status.get('account')} />
  49. </a>
  50. </div>
  51. <div className='status__content' dangerouslySetInnerHTML={content} />
  52. <div style={{ marginTop: '10px', overflow: 'hidden' }}>
  53. <div style={{ float: 'left', marginRight: '10px'}}><IconButton title='Reply' icon='reply' onClick={this.handleReplyClick} /></div>
  54. <div style={{ float: 'left', marginRight: '10px'}}><IconButton active={status.get('reblogged')} title='Reblog' icon='retweet' onClick={this.handleReblogClick} /></div>
  55. <div style={{ float: 'left'}}><IconButton active={status.get('favourited')} title='Favourite' icon='star' onClick={this.handleFavouriteClick} /></div>
  56. </div>
  57. </div>
  58. );
  59. }
  60. });
  61. export default Status;