Skip to content

Commit

Permalink
add image block skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyphilemon committed Jan 15, 2025
1 parent 007a427 commit f240f64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ function PureBlock({
})}
>
{isDocumentsFetching && !block.content ? (
<DocumentSkeleton />
<DocumentSkeleton blockKind={block.kind} />
) : block.kind === 'code' ? (
<CodeEditor
content={
Expand Down
10 changes: 8 additions & 2 deletions components/document-skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
'use client';

export const DocumentSkeleton = () => {
return (
import { BlockKind } from './block';

export const DocumentSkeleton = ({ blockKind }: { blockKind: BlockKind }) => {
return blockKind === 'image' ? (
<div className="flex flex-col gap-4 w-full justify-center items-center h-[calc(100dvh-60px)]">
<div className="animate-pulse rounded-lg bg-muted-foreground/20 size-96" />
</div>
) : (
<div className="flex flex-col gap-4 w-full">
<div className="animate-pulse rounded-lg h-12 bg-muted-foreground/20 w-1/2" />
<div className="animate-pulse rounded-lg h-5 bg-muted-foreground/20 w-full" />
Expand Down

0 comments on commit f240f64

Please sign in to comment.