From 3be39eccc4e416082f32818ec2779cd8bcad895f Mon Sep 17 00:00:00 2001 From: Aminejv Date: Fri, 24 Sep 2021 17:57:51 +0100 Subject: [PATCH] feat(PortalsProvider): add PortalsProvider - will be used with ReactDOM.createPortal to render components to elements that are outside their tree hierarchy --- components/core/Application.js | 54 ++++++++++++++++-------------- components/core/PortalsProvider.js | 16 +++++++++ 2 files changed, 45 insertions(+), 25 deletions(-) create mode 100644 components/core/PortalsProvider.js diff --git a/components/core/Application.js b/components/core/Application.js index 9e8c9bbe..f1d894e3 100644 --- a/components/core/Application.js +++ b/components/core/Application.js @@ -49,6 +49,7 @@ import SidebarEditTags from "~/components/sidebars/SidebarEditTags"; import ApplicationHeader from "~/components/core/ApplicationHeader"; import ApplicationLayout from "~/components/core/ApplicationLayout"; import WebsitePrototypeWrapper from "~/components/core/WebsitePrototypeWrapper"; +import PortalsProvider from "~/components/core/PortalsProvider"; import CTATransition from "~/components/core/CTATransition"; import { GlobalModal } from "~/components/system/components/GlobalModal"; @@ -496,31 +497,34 @@ export default class ApplicationPage extends React.Component { // } return ( - - {this.state.loading ? ( -
- -
- ) : ( - scene - )} -
+ + + {this.state.loading ? ( +
+ +
+ ) : ( + scene + )} +
+
({ filterNavbar }), [filterNavbar]); + + return {children}; +} + +export const usePortals = () => React.useContext(LayoutContext);