about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/display_name.js
blob: 4c65aaefac258454713546179dd9ffbeb31c2c7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//  Package imports.
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';

//  The component.
export default function DisplayName ({
  account,
  className,
  inline,
}) {
  const computedClass = classNames('display-name', { inline }, className);

  //  The result.
  return account ? (
    <span className={computedClass}>
      <strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} />
      {inline ? ' ' : null}
      <span className='display-name__account'>@{account.get('acct')}</span>
    </span>
  ) : null;
}

//  Props.
DisplayName.propTypes = {
  account: ImmutablePropTypes.map,
  className: PropTypes.string,
  inline: PropTypes.bool,
};