about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/display_name.js
blob: d6ac4907d6b3b00465fcdaec2bf072d484bea9de (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}>
      <bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>
      {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,
};