wix-style-react
Version:
48 lines (40 loc) • 1.38 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import IconButton from '../../IconButton/IconButton';
import { SKIN_PRIORITY_MAP } from '../constants';
var Control = function Control(_ref) {
var dataHook = _ref.dataHook,
className = _ref.className,
onClick = _ref.onClick,
icon = _ref.icon,
size = _ref.size,
skin = _ref.skin,
_ref$disabled = _ref.disabled,
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
return /*#__PURE__*/React.createElement(IconButton, {
dataHook: dataHook,
className: className,
onClick: onClick,
size: size,
skin: skin,
disabled: disabled,
priority: SKIN_PRIORITY_MAP[skin]
}, icon);
};
Control.propTypes = {
/** Applied as data-hook HTML attribute that can be used in the tests */
dataHook: PropTypes.string,
/** A css class to be applied to the control element */
className: PropTypes.string,
/** Click handler function for the control */
onClick: PropTypes.func.isRequired,
/** Icon to be rendered within the icon button */
icon: PropTypes.element.isRequired,
/** Size to pass to the icon button rendered */
size: PropTypes.string,
/** Skin to pass to the icon button rendered */
skin: PropTypes.string,
/** Disabled flag to pass to the icon button rendered */
disabled: PropTypes.bool
};
export default Control;