ant-design/.dumi/theme/builtins/Previewer/index.tsx
lijianan 371c10c01f
site: update dumi type (#47326)
* site: update dumi type

* fix: fix

* fix: fix

* fix: fix

* fix: fix
2024-02-04 17:08:39 +08:00

41 lines
941 B
TypeScript

import React, { Suspense } from 'react';
import { Alert, Skeleton } from 'antd';
import { createStyles } from 'antd-style';
import type { IPreviewerProps } from 'dumi';
const { ErrorBoundary } = Alert;
const Previewer = React.lazy(() => import('./Previewer'));
const useStyle = createStyles(({ css }) => ({
skeletonWrapper: css`
width: 100% !important;
height: 250px;
margin-bottom: 16px;
border-radius: 8px;
`,
}));
const PreviewerSuspense: React.FC<IPreviewerProps> = (props) => {
const { styles } = useStyle();
return (
<ErrorBoundary>
<Suspense
fallback={
<Skeleton.Node
active
className={styles.skeletonWrapper}
style={{ width: '100%', height: '100%' }}
>
{' '}
</Skeleton.Node>
}
>
<Previewer {...props} />
</Suspense>
</ErrorBoundary>
);
};
export default PreviewerSuspense;