From 70dd02be202ae1b87ef8f7a2563ba09a3e7b0947 Mon Sep 17 00:00:00 2001
From: Kristóf Marussy <kristof@marussy.com>
Date: Sun, 21 Aug 2022 03:19:03 +0200
Subject: refactor(frontend): improve code splitting

---
 .../frontend/src/editor/SearchPanelPortal.tsx      | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 subprojects/frontend/src/editor/SearchPanelPortal.tsx

(limited to 'subprojects/frontend/src/editor/SearchPanelPortal.tsx')

diff --git a/subprojects/frontend/src/editor/SearchPanelPortal.tsx b/subprojects/frontend/src/editor/SearchPanelPortal.tsx
new file mode 100644
index 00000000..e8301489
--- /dev/null
+++ b/subprojects/frontend/src/editor/SearchPanelPortal.tsx
@@ -0,0 +1,25 @@
+import Portal from '@mui/material/Portal';
+import { observer } from 'mobx-react-lite';
+import React from 'react';
+
+import type EditorStore from './EditorStore';
+import SearchToolbar from './SearchToolbar';
+
+function SearchPanelPortal({
+  editorStore: { searchPanel: searchPanelStore },
+}: {
+  editorStore: EditorStore;
+}): JSX.Element | null {
+  const { element: searchPanelContainer } = searchPanelStore;
+
+  if (searchPanelContainer === undefined) {
+    return null;
+  }
+  return (
+    <Portal container={searchPanelContainer}>
+      <SearchToolbar searchPanelStore={searchPanelStore} />
+    </Portal>
+  );
+}
+
+export default observer(SearchPanelPortal);
-- 
cgit v1.2.3-54-g00ecf

