feat(component): improve fallback skeleton (#2323)

This commit is contained in:
Himself65
2023-05-11 13:35:42 +08:00
committed by GitHub
parent 47848cb5da
commit 73dbb39009
12 changed files with 130 additions and 60 deletions
@@ -1,5 +1,12 @@
import { style } from '@vanilla-extract/css';
export const blockSuiteEditorStyle = style({
padding: '0 1rem',
maxWidth: 'var(--affine-editor-width)',
margin: '0 2rem',
padding: '0 24px',
});
export const blockSuiteEditorHeaderStyle = style({
marginTop: '40px',
marginBottom: '40px',
});
@@ -12,7 +12,10 @@ import { createPortal } from 'react-dom';
import type { FallbackProps } from 'react-error-boundary';
import { ErrorBoundary } from 'react-error-boundary';
import { blockSuiteEditorStyle } from './index.css';
import {
blockSuiteEditorHeaderStyle,
blockSuiteEditorStyle,
} from './index.css';
export type EditorProps = {
page: Page;
@@ -136,10 +139,11 @@ const BlockSuiteErrorFallback = (
export const BlockSuiteFallback = memo(function BlockSuiteFallback() {
return (
<div className={blockSuiteEditorStyle}>
<Skeleton animation="wave" height={60} />
{Array.from({ length: 10 }).map((_, index) => (
<Skeleton animation="wave" height={30} key={index} />
))}
<Skeleton
className={blockSuiteEditorHeaderStyle}
animation="wave"
height={50}
/>
<Skeleton animation="wave" height={30} width="40%" />
</div>
);