mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-13 22:55:07 +01:00
Refactor DisplayName component to make it closer to upstream
This commit is contained in:
parent
cd8763b600
commit
621590b4ab
@ -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,
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user