Skip to content

Commit 1c0843a

Browse files
committed
Add responsive bar to preview component
1 parent b821138 commit 1c0843a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

apps/docs/components/preview.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { readFile } from "node:fs/promises";
22
import { join } from "node:path";
3+
import {
4+
ResizableHandle,
5+
ResizablePanel,
6+
ResizablePanelGroup,
7+
} from "@repo/shadcn-ui/components/ui/resizable";
38
import { cn } from "@repo/shadcn-ui/lib/utils";
49
import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";
510
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
@@ -61,8 +66,17 @@ export const Preview = async ({ path, className }: ComponentPreviewProps) => {
6166

6267
return (
6368
<Tabs items={["Preview", "Code"]}>
64-
<Tab className={cn("not-prose h-[600px] overflow-auto", className)}>
65-
<Component />
69+
<Tab className={cn("not-prose h-[600px] overflow-auto p-0", className)}>
70+
<ResizablePanelGroup direction="horizontal">
71+
<ResizablePanel className="p-4" defaultSize={100}>
72+
<Component />
73+
</ResizablePanel>
74+
<ResizableHandle
75+
className="translate-x-px border-none [&>div]:shrink-0"
76+
withHandle
77+
/>
78+
<ResizablePanel defaultSize={0} />
79+
</ResizablePanelGroup>
6680
</Tab>
6781
<Tab className="p-0">
6882
<div className="h-[600px] [&_.fd-scroll-container]:h-full [&_.fd-scroll-container]:max-h-none">

0 commit comments

Comments
 (0)