@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
34 lines • 1.59 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementOrIllustration = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const illustrationHost_1 = require("../illustration/illustrationHost");
const ElementOrIllustrationComponent = (props, ref) => {
const { illustration: element, ...rest } = props;
if (!element) {
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
}
// element as string
if (typeof element === 'string') {
return (0, jsx_runtime_1.jsx)(illustrationHost_1.IllustrationHost, { ...rest, ref: ref, illustration: element });
}
// element as jsx element
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: element });
};
/**
* ElementOrIllustration component is a component that can be used to display an element or an illustration.
* It can be used to display an illustration or a component.
* @param {IElementOrillustration} props
* @returns {JSX.Element}
* @constructor
* @example
* <ElementOrIllustration illustration="illustration" />
* <ElementOrIllustration illustration={<Illustration illustration="illustration" />} />
* <ElementOrIllustration illustration={<Button variant="primary">Button</Button>} />
*/
exports.ElementOrIllustration = react_1.default.forwardRef(ElementOrIllustrationComponent);
//# sourceMappingURL=elementOrIllustration.js.map