1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-02 16:58:53 +09:00
YuruToot/app/javascript/flavours/glitch/components/display_name.js
2018-01-05 20:43:16 -08:00

31 lines
813 B
JavaScript

// 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,
};