diff options
Diffstat (limited to 'subprojects/frontend/src/editor/SearchPanelPortal.tsx')
-rw-r--r-- | subprojects/frontend/src/editor/SearchPanelPortal.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ | |||
1 | import Portal from '@mui/material/Portal'; | ||
2 | import { observer } from 'mobx-react-lite'; | ||
3 | import React from 'react'; | ||
4 | |||
5 | import type EditorStore from './EditorStore'; | ||
6 | import SearchToolbar from './SearchToolbar'; | ||
7 | |||
8 | function SearchPanelPortal({ | ||
9 | editorStore: { searchPanel: searchPanelStore }, | ||
10 | }: { | ||
11 | editorStore: EditorStore; | ||
12 | }): JSX.Element | null { | ||
13 | const { element: searchPanelContainer } = searchPanelStore; | ||
14 | |||
15 | if (searchPanelContainer === undefined) { | ||
16 | return null; | ||
17 | } | ||
18 | return ( | ||
19 | <Portal container={searchPanelContainer}> | ||
20 | <SearchToolbar searchPanelStore={searchPanelStore} /> | ||
21 | </Portal> | ||
22 | ); | ||
23 | } | ||
24 | |||
25 | export default observer(SearchPanelPortal); | ||