Skip to content

Commit 95b186d

Browse files
committed
improvement(files): use centered aspect-ratio skeleton for mmd file preview
1 parent d8ce2c9 commit 95b186d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Streamdown } from 'streamdown'
1010
import 'streamdown/styles.css'
1111
import { toError } from '@sim/utils/errors'
1212
import { generateShortId } from '@sim/utils/id'
13-
import { Checkbox, CopyCodeButton, highlight, languages } from '@/components/emcn'
13+
import { Checkbox, CopyCodeButton, highlight, languages, Skeleton } from '@/components/emcn'
1414
import '@/components/emcn/components/code/code.css'
1515
import 'prismjs/components/prism-bash'
1616
import 'prismjs/components/prism-css'
@@ -446,6 +446,13 @@ const MermaidDiagram = memo(function MermaidDiagram({
446446
}
447447

448448
if (!trimmedDefinition || !svg || renderedDefinition !== trimmedDefinition) {
449+
if (zoomable) {
450+
return (
451+
<div className='flex h-full items-center justify-center p-8'>
452+
<Skeleton className='w-full rounded-lg' style={{ aspectRatio: '4 / 3' }} />
453+
</div>
454+
)
455+
}
449456
return <MermaidCodeBlockSkeleton />
450457
}
451458
return null

0 commit comments

Comments
 (0)