2018-01-06 04:04:13 +00:00
|
|
|
// Package imports.
|
2017-12-29 22:55:06 +00:00
|
|
|
import classNames from 'classnames';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-05-03 00:04:16 +00:00
|
|
|
import React from 'react';
|
2016-09-01 12:12:11 +00:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
|
2018-01-06 04:04:13 +00:00
|
|
|
// The component.
|
|
|
|
export default function DisplayName ({
|
|
|
|
account,
|
|
|
|
className,
|
|
|
|
inline,
|
|
|
|
}) {
|
|
|
|
const computedClass = classNames('display-name', { inline }, className);
|
2016-09-01 12:12:11 +00:00
|
|
|
|
2018-01-06 04:04:13 +00: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 18:05:35 +00:00
|
|
|
}
|
2018-01-06 04:04:13 +00:00
|
|
|
|
|
|
|
// Props.
|
|
|
|
DisplayName.propTypes = {
|
|
|
|
account: ImmutablePropTypes.map,
|
|
|
|
className: PropTypes.string,
|
|
|
|
inline: PropTypes.bool,
|
|
|
|
};
|