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.

28 lines
787 B

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. import ImmutablePropTypes from 'react-immutable-proptypes';
  2. import PureRenderMixin from 'react-addons-pure-render-mixin';
  3. const DisplayName = React.createClass({
  4. propTypes: {
  5. account: ImmutablePropTypes.map.isRequired
  6. },
  7. mixins: [PureRenderMixin],
  8. render () {
  9. let displayName = this.props.account.get('display_name');
  10. if (displayName.length === 0) {
  11. displayName = this.props.account.get('username');
  12. }
  13. return (
  14. <span style={{ display: 'block', maxWidth: '100%', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>
  15. <strong style={{ fontWeight: 'bold' }}>{displayName}</strong> <span style={{ fontSize: '14px' }}>@{this.props.account.get('acct')}</span>
  16. </span>
  17. );
  18. }
  19. });
  20. export default DisplayName;