This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2018-01-05 20:04:13 -08:00
|
|
|
// Package imports.
|
2017-12-29 14:55:06 -08:00
|
|
|
import classNames from 'classnames';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-05-02 17:04:16 -07:00
|
|
|
import React from 'react';
|
2016-09-01 05:12:11 -07:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
|
2018-01-05 20:04:13 -08:00
|
|
|
// The component.
|
|
|
|
export default function DisplayName ({
|
|
|
|
account,
|
|
|
|
className,
|
|
|
|
inline,
|
|
|
|
}) {
|
|
|
|
const computedClass = classNames('display-name', { inline }, className);
|
2016-09-01 05:12:11 -07:00
|
|
|
|
2018-01-05 20:04:13 -08:00
|
|
|
// 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;
|
2017-04-21 11:05:35 -07:00
|
|
|
}
|
2018-01-05 20:04:13 -08:00
|
|
|
|
|
|
|
// Props.
|
|
|
|
DisplayName.propTypes = {
|
|
|
|
account: ImmutablePropTypes.map,
|
|
|
|
className: PropTypes.string,
|
|
|
|
inline: PropTypes.bool,
|
|
|
|
};
|