@ntragas/pouncejstest
Version:
A collection of UI components from Panther labs
39 lines (37 loc) • 1.62 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import React from 'react';
import Icon from '../Icon';
import useIconButtonStyles from './useIconButtonStyles';
import AbstractButton from '../AbstractButton';
/** A wrapper that makes an <a href="/#/Icon">Icon<a> component be clickable */
export var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref, ref) {
var _ref$variantColor = _ref.variantColor,
variantColor = _ref$variantColor === void 0 ? 'blue' : _ref$variantColor,
_ref$variantBorderSty = _ref.variantBorderStyle,
variantBorderStyle = _ref$variantBorderSty === void 0 ? 'square' : _ref$variantBorderSty,
_ref$active = _ref.active,
active = _ref$active === void 0 ? false : _ref$active,
_ref$variant = _ref.variant,
variant = _ref$variant === void 0 ? 'solid' : _ref$variant,
_ref$size = _ref.size,
size = _ref$size === void 0 ? 'large' : _ref$size,
icon = _ref.icon,
rest = _objectWithoutPropertiesLoose(_ref, ["variantColor", "variantBorderStyle", "active", "variant", "size", "icon"]);
var styles = useIconButtonStyles({
variantColor,
variant,
variantBorderStyle,
size
});
return /*#__PURE__*/React.createElement(AbstractButton, _extends({
"aria-pressed": active !== undefined ? active : undefined,
"data-active": active || undefined
}, styles, rest, {
ref: ref
}), /*#__PURE__*/React.createElement(Icon, {
type: icon,
size: size
}));
});
export default IconButton;