UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

33 lines (28 loc) 965 B
import React from "react"; import BasePortal from '@zohodesk/dotkit/es/react/components/Portal/Portal'; import { getLibraryConfig } from "../../Provider/Config"; import { defaultProps } from "./props/defaultProps"; import { propTypes } from "./props/propTypes"; export default function Portal(_ref) { let { children, portalId } = _ref; const portalPrefix = getLibraryConfig("portalPrefix"); const getPortalContainer = () => { const getPortalContainer = getLibraryConfig('getPortalContainer'); if (getPortalContainer && typeof getPortalContainer === 'function') { const portal = getPortalContainer(); if (portal) { return portal; } } return null; }; return /*#__PURE__*/React.createElement(BasePortal, { portalId: `${portalPrefix ? `${portalPrefix}` : ''}${portalId}`, getFallbackElement: getPortalContainer }, children); } Portal.propTypes = propTypes; Portal.defaultProps = defaultProps;