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.

24 lines
927 B

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. import ImmutablePropTypes from 'react-immutable-proptypes';
  2. import escapeTextContentForBrowser from 'escape-html';
  3. import emojify from '../emoji';
  4. class DisplayName extends React.PureComponent {
  5. render () {
  6. const displayName = this.props.account.get('display_name').length === 0 ? this.props.account.get('username') : this.props.account.get('display_name');
  7. const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
  8. return (
  9. <span style={{ display: 'block', maxWidth: '100%', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }} className='display-name'>
  10. <strong style={{ fontWeight: '500' }} dangerouslySetInnerHTML={displayNameHTML} /> <span style={{ fontSize: '14px' }}>@{this.props.account.get('acct')}</span>
  11. </span>
  12. );
  13. }
  14. };
  15. DisplayName.propTypes = {
  16. account: ImmutablePropTypes.map.isRequired
  17. }
  18. export default DisplayName;