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