addons/isl/src/debug/ComponentExplorer.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import {Button} from 'isl-components/Button';
b69ab319import {Icon} from 'isl-components/Icon';
b69ab3110import {Suspense, lazy} from 'react';
b69ab3111import {T} from '../i18n';
b69ab3112import {useModal} from '../useModal';
b69ab3113
b69ab3114const ComponentExplorer = lazy(() => import('isl-components/explorer/ComponentExplorer'));
b69ab3115
b69ab3116export function ComponentExplorerButton({dismiss}: {dismiss: () => unknown}) {
b69ab3117 const showModal = useModal();
b69ab3118 return (
b69ab3119 <Button
b69ab3120 onClick={() => {
b69ab3121 dismiss();
b69ab3122 showModal({
b69ab3123 maxWidth: 'calc(min(90vw, 1200px)',
b69ab3124 maxHeight: 'calc(min(90vw, 800px)',
b69ab3125 width: 'inherit',
b69ab3126 height: 'inherit',
b69ab3127 type: 'custom',
b69ab3128 dataTestId: 'component-explorer',
b69ab3129 component: () => (
b69ab3130 <Suspense fallback={<Icon icon="loading" size="M" />}>
b69ab3131 <ComponentExplorer />
b69ab3132 </Suspense>
b69ab3133 ),
b69ab3134 });
b69ab3135 }}>
b69ab3136 <T>Open Component Explorer</T>
b69ab3137 </Button>
b69ab3138 );
b69ab3139}