]> cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/components/display_name.js
Use ES Class Fields & Static Properties (#3008)
[mastodon.git] / app / javascript / mastodon / components / display_name.js
1 import React from 'react';
2 import ImmutablePropTypes from 'react-immutable-proptypes';
3 import escapeTextContentForBrowser from 'escape-html';
4 import emojify from '../emoji';
5
6 class DisplayName extends React.PureComponent {
7
8 static propTypes = {
9 account: ImmutablePropTypes.map.isRequired
10 };
11
12 render () {
13 const displayName = this.props.account.get('display_name').length === 0 ? this.props.account.get('username') : this.props.account.get('display_name');
14 const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
15
16 return (
17 <span className='display-name'>
18 <strong className='display-name__html' dangerouslySetInnerHTML={displayNameHTML} /> <span className='display-name__account'>@{this.props.account.get('acct')}</span>
19 </span>
20 );
21 }
22
23 }
24
25 export default DisplayName;
This page took 0.073546 seconds and 4 git commands to generate.