Refactor DisplayName component to make it closer to upstream

main
Thibaut Girka 2019-07-23 10:45:35 +02:00
parent cd8763b600
commit 621590b4ab
1 changed files with 54 additions and 58 deletions

View File

@ -1,18 +1,22 @@
// Package imports.
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
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);
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,
};
}