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.

76 lines
1.8 KiB

  1. import PureRenderMixin from 'react-addons-pure-render-mixin';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import Avatar from '../../../components/avatar';
  4. import DisplayName from '../../../components/display_name';
  5. import { Link } from 'react-router';
  6. const outerStyle = {
  7. marginBottom: '10px',
  8. borderTop: '1px solid #616b86'
  9. };
  10. const headerStyle = {
  11. fontSize: '14px',
  12. fontWeight: '500',
  13. display: 'block',
  14. padding: '10px',
  15. color: '#9baec8',
  16. background: '#454b5e',
  17. width: '120px',
  18. marginTop: '-18px'
  19. };
  20. const itemStyle = {
  21. display: 'block',
  22. padding: '10px',
  23. color: '#9baec8',
  24. overflow: 'hidden',
  25. textDecoration: 'none'
  26. };
  27. const displayNameStyle = {
  28. display: 'block',
  29. fontWeight: '500'
  30. };
  31. const acctStyle = {
  32. display: 'block'
  33. };
  34. const SuggestionsBox = React.createClass({
  35. propTypes: {
  36. accounts: ImmutablePropTypes.list.isRequired
  37. },
  38. mixins: [PureRenderMixin],
  39. render () {
  40. const accounts = this.props.accounts.take(2);
  41. return (
  42. <div style={outerStyle}>
  43. <strong style={headerStyle}>Who to follow</strong>
  44. {accounts.map(account => {
  45. let displayName = account.get('display_name');
  46. if (displayName.length === 0) {
  47. displayName = account.get('username');
  48. }
  49. return (
  50. <Link key={account.get('id')} style={itemStyle} to={`/accounts/${account.get('id')}`}>
  51. <div style={{ float: 'left', marginRight: '10px' }}><Avatar src={account.get('avatar')} size={36} /></div>
  52. <strong style={displayNameStyle}>{displayName}</strong>
  53. <span style={acctStyle}>{account.get('acct')}</span>
  54. </Link>
  55. )
  56. })}
  57. </div>
  58. );
  59. }
  60. });
  61. export default SuggestionsBox;