Skip to content

Commit

Permalink
fix: add blueprint provider to root layout (#687)
Browse files Browse the repository at this point in the history
Set the portal container to the root layout div so we can open dialogs when in fullscreen
  • Loading branch information
targos authored Mar 16, 2024
1 parent a91278f commit e8aebd4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
16 changes: 10 additions & 6 deletions src/components/root-layout/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FocusStyleManager } from '@blueprintjs/core';
import { BlueprintProvider, FocusStyleManager } from '@blueprintjs/core';
import { QueryClientProvider } from '@tanstack/react-query';
import { CSSProperties, ReactNode, useCallback, useState } from 'react';

Expand Down Expand Up @@ -35,11 +35,15 @@ export function RootLayout(props: RootLayoutProps) {
return (
<div style={{ ...style, ...props.style }} translate="no">
<CustomDivPreflight ref={ref}>
<RootLayoutProvider innerRef={rootRef}>
<QueryClientProvider client={queryClient}>
<AccordionProvider>{props.children}</AccordionProvider>
</QueryClientProvider>
</RootLayoutProvider>
<BlueprintProvider
{...(rootRef ? { portalContainer: rootRef } : undefined)}
>
<RootLayoutProvider innerRef={rootRef}>
<QueryClientProvider client={queryClient}>
<AccordionProvider>{props.children}</AccordionProvider>
</QueryClientProvider>
</RootLayoutProvider>
</BlueprintProvider>
</CustomDivPreflight>
</div>
);
Expand Down
16 changes: 8 additions & 8 deletions src/pages/demo/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import '@blueprintjs/icons/lib/css/blueprint-icons.css';

export default function App() {
return (
<RootLayout>
<KbsProvider>
<AppStateProvider>
<FullScreenProvider>
<FullScreenProvider>
<RootLayout>
<KbsProvider>
<AppStateProvider>
<MainLayout />
</FullScreenProvider>
</AppStateProvider>
</KbsProvider>
</RootLayout>
</AppStateProvider>
</KbsProvider>
</RootLayout>
</FullScreenProvider>
);
}

0 comments on commit e8aebd4

Please sign in to comment.