@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
64 lines (59 loc) • 1.81 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import PropTypes from 'prop-types';
import React__default from 'react';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix.js';
const ButtonSkeleton = _ref => {
let {
className,
small = false,
href,
size = 'lg',
...rest
} = _ref;
const prefix = usePrefix();
const buttonClasses = cx(className, {
[`${prefix}--skeleton`]: true,
[`${prefix}--btn`]: true,
[`${prefix}--btn--sm`]: small || size === 'sm',
[`${prefix}--btn--md`]: size === 'md',
[`${prefix}--btn--lg`]: size === 'lg'
});
const commonProps = {
className: buttonClasses,
...rest
};
const button = /*#__PURE__*/React__default.createElement("div", commonProps);
const anchor = /*#__PURE__*/React__default.createElement("a", _extends({}, commonProps, {
href: href,
role: "button"
})); // eslint-disable-line
return href ? anchor : button;
};
ButtonSkeleton.propTypes = {
/**
* Specify an optional className to add.
*/
className: PropTypes.string,
/**
* Optionally specify an href for your Button to become an `<a>` element
*/
href: PropTypes.string,
/**
* Specify the size of the button, from a list of available sizes.
* For `default` buttons, this prop can remain unspecified or use `default`.
* In the next major release of Carbon, `default`, `field`, and `small` will be removed
*/
size: PropTypes.oneOf(['sm', 'md', 'lg']),
/**
* @deprecated This property will be removed in the next major Carbon version,
* use size={sm} instead.
*
* Specify whether the Button should be a small variant
*/
small: PropTypes.bool
};
export { ButtonSkeleton, ButtonSkeleton as default };