mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
||
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||
|
var _excluded = ["bsPrefix", "variant", "size", "active", "className", "block", "type", "as"];
|
||
|
import classNames from 'classnames';
|
||
|
import React from 'react';
|
||
|
import { useBootstrapPrefix } from './ThemeProvider';
|
||
|
import SafeAnchor from './SafeAnchor';
|
||
|
var defaultProps = {
|
||
|
variant: 'primary',
|
||
|
active: false,
|
||
|
disabled: false
|
||
|
};
|
||
|
var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
||
|
var bsPrefix = _ref.bsPrefix,
|
||
|
variant = _ref.variant,
|
||
|
size = _ref.size,
|
||
|
active = _ref.active,
|
||
|
className = _ref.className,
|
||
|
block = _ref.block,
|
||
|
type = _ref.type,
|
||
|
as = _ref.as,
|
||
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
||
|
|
||
|
var prefix = useBootstrapPrefix(bsPrefix, 'btn');
|
||
|
var classes = classNames(className, prefix, active && 'active', variant && prefix + "-" + variant, block && prefix + "-block", size && prefix + "-" + size);
|
||
|
|
||
|
if (props.href) {
|
||
|
return /*#__PURE__*/React.createElement(SafeAnchor, _extends({}, props, {
|
||
|
as: as,
|
||
|
ref: ref,
|
||
|
className: classNames(classes, props.disabled && 'disabled')
|
||
|
}));
|
||
|
}
|
||
|
|
||
|
if (ref) {
|
||
|
props.ref = ref;
|
||
|
}
|
||
|
|
||
|
if (type) {
|
||
|
props.type = type;
|
||
|
} else if (!as) {
|
||
|
props.type = 'button';
|
||
|
}
|
||
|
|
||
|
var Component = as || 'button';
|
||
|
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
||
|
className: classes
|
||
|
}));
|
||
|
});
|
||
|
Button.displayName = 'Button';
|
||
|
Button.defaultProps = defaultProps;
|
||
|
export default Button;
|