闭社主体 forked from https://github.com/tootsuite/mastodon
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.

25 lines
847 B

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