Lidarr/frontend/src/Components/Link/IconButton.js

59 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-09-07 01:33:10 +00:00
import classNames from 'classnames';
2017-09-04 02:20:56 +00:00
import PropTypes from 'prop-types';
import React from 'react';
import Icon from 'Components/Icon';
import Link from './Link';
import styles from './IconButton.css';
function IconButton(props) {
const {
className,
iconClassName,
name,
kind,
size,
isSpinning,
2018-03-15 01:28:46 +00:00
isDisabled,
2017-09-04 02:20:56 +00:00
...otherProps
} = props;
return (
<Link
2018-03-15 01:28:46 +00:00
className={classNames(
className,
isDisabled && styles.isDisabled
)}
aria-label="Table Options Button"
2018-03-15 01:28:46 +00:00
isDisabled={isDisabled}
2017-09-04 02:20:56 +00:00
{...otherProps}
>
<Icon
className={iconClassName}
name={name}
kind={kind}
size={size}
isSpinning={isSpinning}
2017-09-04 02:20:56 +00:00
/>
</Link>
);
}
IconButton.propTypes = {
...Link.propTypes,
2017-09-04 02:20:56 +00:00
className: PropTypes.string.isRequired,
iconClassName: PropTypes.string,
kind: PropTypes.string,
2018-01-22 03:56:41 +00:00
name: PropTypes.object.isRequired,
size: PropTypes.number,
title: PropTypes.string,
2018-03-15 01:28:46 +00:00
isSpinning: PropTypes.bool,
isDisabled: PropTypes.bool
2017-09-04 02:20:56 +00:00
};
IconButton.defaultProps = {
className: styles.button,
size: 12
2017-09-04 02:20:56 +00:00
};
export default IconButton;