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,
|
2018-01-14 22:11:37 +00:00
|
|
|
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
|
|
|
|
)}
|
2023-04-30 04:05:21 +00:00
|
|
|
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}
|
2018-01-14 22:11:37 +00:00
|
|
|
isSpinning={isSpinning}
|
2017-09-04 02:20:56 +00:00
|
|
|
/>
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
IconButton.propTypes = {
|
2023-07-10 21:42:51 +00:00
|
|
|
...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,
|
2018-01-14 22:11:37 +00:00
|
|
|
size: PropTypes.number,
|
2023-07-10 21:42:51 +00:00
|
|
|
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 = {
|
2018-01-26 03:01:53 +00:00
|
|
|
className: styles.button,
|
|
|
|
size: 12
|
2017-09-04 02:20:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default IconButton;
|