Use upstream's Icon component
Rework the codebase to avoid unnecessary differences with upstream
This commit is contained in:
@@ -1,26 +1,21 @@
|
||||
// Package imports.
|
||||
import classNames from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export default class Icon extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
id: PropTypes.string.isRequired,
|
||||
className: PropTypes.string,
|
||||
fixedWidth: PropTypes.bool,
|
||||
};
|
||||
|
||||
render () {
|
||||
const { id, className, fixedWidth, ...other } = this.props;
|
||||
|
||||
return (
|
||||
<i role='img' className={classNames('fa', `fa-${id}`, className, { 'fa-fw': fixedWidth })} {...other} />
|
||||
);
|
||||
}
|
||||
|
||||
// This just renders a FontAwesome icon.
|
||||
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.
|
||||
Icon.propTypes = {
|
||||
className: PropTypes.string,
|
||||
fullwidth: PropTypes.bool,
|
||||
icon: PropTypes.string,
|
||||
};
|
||||
|
Reference in New Issue
Block a user