aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/SearchPanelPortal.tsx
blob: b4b07c74d8c34ea1a882b706ce486ded91d5f19a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */

import Portal from '@mui/material/Portal';
import { observer } from 'mobx-react-lite';

import type EditorStore from './EditorStore';
import SearchToolbar from './SearchToolbar';

export default observer(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>
  );
});