feat: add list skeleton in public workspace (#1278)

This commit is contained in:
Himself65
2023-03-02 15:11:37 -06:00
committed by GitHub
parent 0507300a29
commit 9d46b358d4
3 changed files with 30 additions and 2 deletions

View File

@@ -1,4 +1,6 @@
import { ListSkeleton } from '@affine/component';
import { useAtomValue, useSetAtom } from 'jotai';
import dynamic from 'next/dynamic';
import { useRouter } from 'next/router';
import React, { Suspense, useCallback, useEffect } from 'react';
@@ -8,11 +10,17 @@ import {
publicWorkspaceIdAtom,
} from '../../atoms/public-workspace';
import { QueryParamError } from '../../components/affine/affine-error-eoundary';
import { BlockSuitePublicPageList } from '../../components/blocksuite/block-suite-page-list';
import { StyledTableContainer } from '../../components/blocksuite/block-suite-page-list/page-list/styles';
import { PageLoading } from '../../components/pure/loading';
import { WorkspaceLayout } from '../../layouts';
import { NextPageWithLayout } from '../../shared';
const BlockSuitePublicPageList = dynamic(
async () =>
(await import('../../components/blocksuite/block-suite-page-list'))
.BlockSuitePublicPageList
);
const ListPageInner: React.FC<{
workspaceId: string;
}> = ({ workspaceId }) => {
@@ -64,7 +72,13 @@ const ListPage: NextPageWithLayout = () => {
throw new QueryParamError('workspaceId', workspaceId);
}
return (
<Suspense fallback={<PageLoading />}>
<Suspense
fallback={
<StyledTableContainer>
<ListSkeleton />
</StyledTableContainer>
}
>
<ListPageInner workspaceId={workspaceId} />
</Suspense>
);

View File

@@ -0,0 +1,13 @@
import { Skeleton } from '@mui/material';
import { memo } from 'react';
export const ListSkeleton = memo(function ListItemSkeleton() {
return (
<>
<Skeleton animation="wave" height={40} />
<Skeleton animation="wave" height={40} />
<Skeleton animation="wave" height={40} />
<Skeleton animation="wave" height={40} />
</>
);
});

View File

@@ -1,4 +1,5 @@
// export * from './components/BlockSuiteEditor';
export * from './components/ListSkeleton';
export * from './styles';
export * from './ui/breadcrumbs';
export * from './ui/button';