UNPKG

@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

28 lines 1.23 kB
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { IllustrationHost as Illustration } from '../illustration/illustrationHost'; const ElementOrIllustrationComponent = (props, ref) => { const { illustration: element, ...rest } = props; if (!element) { return _jsx(_Fragment, {}); } // element as string if (typeof element === 'string') { return _jsx(Illustration, { ...rest, ref: ref, illustration: element }); } // element as jsx element return _jsx(_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>} /> */ export const ElementOrIllustration = React.forwardRef(ElementOrIllustrationComponent); //# sourceMappingURL=elementOrIllustration.js.map