mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-07 13:32:17 -07:00
56 lines
1.1 KiB
JavaScript
56 lines
1.1 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React 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 {
|
|
className,
|
|
name,
|
|
kind,
|
|
size,
|
|
title,
|
|
isSpinning,
|
|
...otherProps
|
|
} = props;
|
|
|
|
if (title && !window.Lidarr.isProduction) {
|
|
console.error('Icons cannot have a title');
|
|
}
|
|
|
|
return (
|
|
<FontAwesomeIcon
|
|
className={classNames(
|
|
className,
|
|
styles[kind]
|
|
)}
|
|
icon={name}
|
|
spin={isSpinning}
|
|
style={{
|
|
fontSize: `${size}px`
|
|
}}
|
|
{...otherProps}
|
|
/>
|
|
);
|
|
}
|
|
|
|
Icon.propTypes = {
|
|
className: PropTypes.string,
|
|
name: PropTypes.object.isRequired,
|
|
kind: PropTypes.string.isRequired,
|
|
size: PropTypes.number.isRequired,
|
|
title: PropTypes.string,
|
|
isSpinning: PropTypes.bool.isRequired,
|
|
fixedWidth: PropTypes.bool.isRequired
|
|
};
|
|
|
|
Icon.defaultProps = {
|
|
kind: kinds.DEFAULT,
|
|
size: 14,
|
|
isSpinning: false,
|
|
fixedWidth: false
|
|
};
|
|
|
|
export default Icon;
|