Fixed: Rendering Tweaks to UI

This commit is contained in:
Qstick 2019-02-27 22:15:24 -05:00
parent 2c8b137349
commit 795a445b52
3 changed files with 179 additions and 159 deletions

View file

@ -1,49 +1,55 @@
import PropTypes from 'prop-types';
import React from 'react';
import React, { PureComponent } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { kinds } from 'Helpers/Props';
import classNames from 'classnames';
import styles from './Icon.css';
function Icon(props) {
const {
containerClassName,
className,
name,
kind,
size,
title,
isSpinning,
...otherProps
} = props;
class Icon extends PureComponent {
const icon = (
<FontAwesomeIcon
className={classNames(
className,
styles[kind]
)}
icon={name}
spin={isSpinning}
style={{
fontSize: `${size}px`
}}
{...otherProps}
/>
);
//
// Render
if (title) {
return (
<span
className={containerClassName}
title={title}
>
{icon}
</span>
render() {
const {
containerClassName,
className,
name,
kind,
size,
title,
isSpinning,
...otherProps
} = this.props;
const icon = (
<FontAwesomeIcon
className={classNames(
className,
styles[kind]
)}
icon={name}
spin={isSpinning}
style={{
fontSize: `${size}px`
}}
{...otherProps}
/>
);
}
return icon;
if (title) {
return (
<span
className={containerClassName}
title={title}
>
{icon}
</span>
);
}
return icon;
}
}
Icon.propTypes = {