UNPKG

pouncejs

Version:

A collection of UI components from Panther labs

43 lines (41 loc) 1.84 kB
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-400' : _ref$variantColor, _ref$iconColor = _ref.iconColor, iconColor = _ref$iconColor === void 0 ? 'white' : _ref$iconColor, _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", "iconColor", "variantBorderStyle", "active", "variant", "size", "icon"]); var styles = useIconButtonStyles({ variantColor: variantColor, iconColor: iconColor, variant: variant, variantBorderStyle: variantBorderStyle, size: 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, { color: iconColor, type: icon, size: size })); }); export default IconButton;