Skip to content

Commit 7b40802

Browse files
fix(docs): allow customizable preview stage height and expand navbar stage
1 parent 2953bb0 commit 7b40802

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

‎content/docs/components/navigation/navbar.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { PreviewComponents } from "@/components/docs/preview-components";
77
import { NavBarDemo } from "@/components/docs/navbar-demo";
88
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
99

10-
<PreviewComponents registryName="navbar" fullBleed>
10+
<PreviewComponents registryName="navbar" fullBleed stageClassName="min-h-[26rem]">
1111
<NavBarDemo />
1212
</PreviewComponents>
1313

‎src/components/docs/preview-card.tsx‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ interface PreviewCardProps {
1313
registryName: string;
1414
/** Skip the centered padding — for components that span the full width, like NavBar. */
1515
fullBleed?: boolean;
16+
/** Additional classes for the stage container. */
17+
stageClassName?: string;
1618
children: ReactNode;
1719
}
1820

@@ -42,7 +44,12 @@ function openWith(target: "v0" | "lovable" | "bolt", registryName: string) {
4244
window.open(url, "_blank", "noopener,noreferrer");
4345
}
4446

45-
export function PreviewCard({ registryName, fullBleed, children }: PreviewCardProps) {
47+
export function PreviewCard({
48+
registryName,
49+
fullBleed,
50+
stageClassName,
51+
children,
52+
}: PreviewCardProps) {
4653
const { theme, dark, setTheme, setDark } = usePreviewPrefs();
4754
const [replayKey, setReplayKey] = useState(0);
4855
const [themeOpen, setThemeOpen] = useState(false);
@@ -157,9 +164,14 @@ export function PreviewCard({ registryName, fullBleed, children }: PreviewCardPr
157164
>
158165
<div key={replayKey}>
159166
{fullBleed ? (
160-
<div className="min-h-[340px]">{children}</div>
167+
<div className={cn("min-h-[22rem]", stageClassName)}>{children}</div>
161168
) : (
162-
<div className="flex min-h-[420px] flex-col items-center justify-center gap-8 px-4 py-14 sm:px-10">
169+
<div
170+
className={cn(
171+
"flex min-h-[420px] flex-col items-center justify-center gap-8 px-4 py-14 sm:px-10",
172+
stageClassName,
173+
)}
174+
>
163175
{children}
164176
</div>
165177
)}

‎src/components/docs/preview-components.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ interface PreviewComponentsProps {
1414
demo?: string;
1515
/** Skip the centered padding around the demo — for full-width components. */
1616
fullBleed?: boolean;
17+
/** Additional classes for the preview stage container. */
18+
stageClassName?: string;
1719
children: React.ReactNode;
1820
}
1921

@@ -29,6 +31,7 @@ export function PreviewComponents({
2931
registryName,
3032
demo,
3133
fullBleed,
34+
stageClassName,
3235
children,
3336
}: PreviewComponentsProps) {
3437
const path = demo ?? `components/docs/${registryName}-demo.tsx`;
@@ -39,7 +42,11 @@ export function PreviewComponents({
3942
return (
4043
<Tabs items={["Preview", "Code"]} className="border-none bg-transparent">
4144
<Tab value="Preview" className="mt-3 border-none bg-transparent p-0">
42-
<PreviewCard registryName={registryName} fullBleed={fullBleed}>
45+
<PreviewCard
46+
registryName={registryName}
47+
fullBleed={fullBleed}
48+
stageClassName={stageClassName}
49+
>
4350
{children}
4451
</PreviewCard>
4552
</Tab>

0 commit comments

Comments
 (0)