Refactor DisplayName component to make it closer to upstream

master
Thibaut Girka 5 years ago
parent cd8763b600
commit 621590b4ab
  1. 38
      app/javascript/flavours/glitch/components/display_name.js

@ -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…
Cancel
Save