Refactor DisplayName component to make it closer to upstream

This commit is contained in:
Thibaut Girka 2019-07-23 10:45:35 +02:00
parent cd8763b600
commit 621590b4ab

View File

@ -1,18 +1,22 @@
// Package imports.
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class DisplayName extends React.PureComponent {
static propTypes = {
account: ImmutablePropTypes.map,
className: PropTypes.string,
inline: PropTypes.bool,
localDomain: PropTypes.string,
others: ImmutablePropTypes.list,
handleClick: PropTypes.func,
};
render() {
const { account, className, inline, localDomain, others, onAccountClick } = this.props;
// The component.
export default function DisplayName ({
account,
className,
inline,
localDomain,
others,
onAccountClick,
}) {
const computedClass = classNames('display-name', { inline }, className); const computedClass = classNames('display-name', { inline }, className);
if (!account) return null; if (!account) return null;
@ -62,12 +66,4 @@ export default function DisplayName ({
); );
} }
// Props. }
DisplayName.propTypes = {
account: ImmutablePropTypes.map,
className: PropTypes.string,
inline: PropTypes.bool,
localDomain: PropTypes.string,
others: ImmutablePropTypes.list,
handleClick: PropTypes.func,
};