Rework the codebase to avoid unnecessary differences with upstreamth-downstream
parent
080bdf6949
commit
6b45aa450b
@ -1,26 +1,21 @@
|
|||||||
// Package imports.
|
|
||||||
import classNames from 'classnames';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
// This just renders a FontAwesome icon.
|
export default class Icon extends React.PureComponent {
|
||||||
export default function Icon ({
|
|
||||||
className,
|
|
||||||
fullwidth,
|
|
||||||
icon,
|
|
||||||
}) {
|
|
||||||
const computedClass = classNames('icon', 'fa', { 'fa-fw': fullwidth }, `fa-${icon}`, className);
|
|
||||||
return icon ? (
|
|
||||||
<span
|
|
||||||
aria-hidden='true'
|
|
||||||
className={computedClass}
|
|
||||||
/>
|
|
||||||
) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Props.
|
static propTypes = {
|
||||||
Icon.propTypes = {
|
id: PropTypes.string.isRequired,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
fullwidth: PropTypes.bool,
|
fixedWidth: PropTypes.bool,
|
||||||
icon: PropTypes.string,
|
};
|
||||||
};
|
|
||||||
|
render () {
|
||||||
|
const { id, className, fixedWidth, ...other } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<i role='img' className={classNames('fa', `fa-${id}`, className, { 'fa-fw': fixedWidth })} {...other} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in new issue