@cbinsights/fds
Version:
Form: A design system by CB Insights
34 lines (29 loc) • 692 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* Common pattern where we use href to generate whether
* an href or a button is returned, and also allow a master
* override where you can specify any element / component as
* the root
*/
var baseElement = function baseElement(_ref) {
var href = _ref.href,
onClick = _ref.onClick,
as = _ref.as;
var Element;
if (as) {
Element = as;
} else if (href || href && onClick) {
Element = 'a';
} else if (onClick) {
Element = 'button';
} else {
Element = 'div';
}
return Element;
};
var _default = baseElement;
exports.default = _default;