1.1 KB40 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import {Button} from 'isl-components/Button';
9import {Icon} from 'isl-components/Icon';
10import {Suspense, lazy} from 'react';
11import {T} from '../i18n';
12import {useModal} from '../useModal';
13
14const ComponentExplorer = lazy(() => import('isl-components/explorer/ComponentExplorer'));
15
16export function ComponentExplorerButton({dismiss}: {dismiss: () => unknown}) {
17 const showModal = useModal();
18 return (
19 <Button
20 onClick={() => {
21 dismiss();
22 showModal({
23 maxWidth: 'calc(min(90vw, 1200px)',
24 maxHeight: 'calc(min(90vw, 800px)',
25 width: 'inherit',
26 height: 'inherit',
27 type: 'custom',
28 dataTestId: 'component-explorer',
29 component: () => (
30 <Suspense fallback={<Icon icon="loading" size="M" />}>
31 <ComponentExplorer />
32 </Suspense>
33 ),
34 });
35 }}>
36 <T>Open Component Explorer</T>
37 </Button>
38 );
39}
40