ruffer-pattern-portfolio
Version:
This is the end result from https://dev.to/swyx/quick-guide-to-setup-your-react--typescript-storybook-design-system-1c51
22 lines (21 loc) • 1.55 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var react_redux_1 = require("react-redux");
var react_bootstrap_1 = require("react-bootstrap");
var LoadingSection_1 = require("../LoadingSection/LoadingSection");
exports.Button = function (props) {
var _a = props.loading, loading = _a === void 0 ? false : _a, _b = props.value, value = _b === void 0 ? 'Button' : _b, _c = props.classNames, classNames = _c === void 0 ? '' : _c, _d = props.variant, variant = _d === void 0 ? "success" : _d, _e = props.size, size = _e === void 0 ? "sm" : _e, _f = props.type, type = _f === void 0 ? 'submit' : _f, _g = props.badgeValue, badgeValue = _g === void 0 ? null : _g, _h = props.onClick, onClick = _h === void 0 ? null : _h, _j = props.onMouseOver, onMouseOver = _j === void 0 ? null : _j;
if (loading) {
return (react_1.default.createElement(LoadingSection_1.LoadingSection, { className: "w-10 h-50" }));
}
var badgeValueEl = badgeValue && (react_1.default.createElement("span", { className: "badge badge-light" }, badgeValue));
return (react_1.default.createElement(react_bootstrap_1.Button, { variant: variant, className: classNames, disabled: loading, type: type, size: size },
value,
" ",
badgeValueEl));
};
exports.default = react_redux_1.connect()(exports.Button);