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.

30 lines
824 B

8 years ago
8 years ago
  1. // Package imports.
  2. import classNames from 'classnames';
  3. import PropTypes from 'prop-types';
  4. import React from 'react';
  5. import ImmutablePropTypes from 'react-immutable-proptypes';
  6. // The component.
  7. export default function DisplayName ({
  8. account,
  9. className,
  10. inline,
  11. }) {
  12. const computedClass = classNames('display-name', { inline }, className);
  13. // The result.
  14. return account ? (
  15. <span className={computedClass}>
  16. <bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>
  17. {inline ? ' ' : null}
  18. <span className='display-name__account'>@{account.get('acct')}</span>
  19. </span>
  20. ) : null;
  21. }
  22. // Props.
  23. DisplayName.propTypes = {
  24. account: ImmutablePropTypes.map,
  25. className: PropTypes.string,
  26. inline: PropTypes.bool,
  27. };