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
31 lines (30 loc) • 1.74 kB
JavaScript
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar(require("react"));
var react_redux_1 = require("react-redux");
var react_bootstrap_1 = require("react-bootstrap");
var LoadingSection_1 = require("../LoadingSection/LoadingSection");
exports.Badge = function (props) {
var _a = props.loading, loading = _a === void 0 ? false : _a, _b = props.value, value = _b === void 0 ? 'Badge' : _b, _c = props.classNames, classNames = _c === void 0 ? '' : _c, _d = props.variant, variant = _d === void 0 ? 'light' : _d, link = props.link, _e = props.pill, pill = _e === void 0 ? false : _e;
if (loading) {
return (react_1.default.createElement(react_bootstrap_1.Badge, null,
react_1.default.createElement(LoadingSection_1.LoadingSection, { className: "w-50", background: "fff" })));
}
var badge = pill
? react_1.default.createElement(react_bootstrap_1.Badge, { pill: true, className: classNames, variant: variant }, value)
: react_1.default.createElement(react_bootstrap_1.Badge, { className: classNames, variant: variant }, value);
return (react_1.default.createElement(react_1.Fragment, null, link
? (react_1.default.createElement("a", { href: link, style: { textDecoration: 'none' } },
" ",
badge,
" "))
: badge));
};
exports.default = react_redux_1.connect()(exports.Badge);