mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
docs: add fallback for previewer (#44327)
* docs: add fallback for previewer * chore: code clean
This commit is contained in:
parent
b26e3a77f9
commit
da699b11be
@ -1,10 +1,36 @@
|
||||
import React, { Suspense } from 'react';
|
||||
import type { IPreviewerProps } from 'dumi';
|
||||
import { Skeleton } from 'antd';
|
||||
import { createStyles } from 'antd-style';
|
||||
|
||||
const Previewer = React.lazy(() => import('./Previewer'));
|
||||
|
||||
export default (props: IPreviewerProps) => (
|
||||
<Suspense fallback={null}>
|
||||
<Previewer {...props} />
|
||||
</Suspense>
|
||||
);
|
||||
const useStyle = createStyles(({ css }) => ({
|
||||
skeletonWrapper: css`
|
||||
width: 100% !important;
|
||||
height: 500px;
|
||||
margin-bottom: 16px;
|
||||
`,
|
||||
}));
|
||||
|
||||
export default (props: IPreviewerProps) => {
|
||||
const { styles } = useStyle();
|
||||
return (
|
||||
<Suspense
|
||||
fallback={
|
||||
<Skeleton.Node
|
||||
active
|
||||
className={styles.skeletonWrapper}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
}}
|
||||
>
|
||||
{' '}
|
||||
</Skeleton.Node>
|
||||
}
|
||||
>
|
||||
<Previewer {...props} />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user