Skip to content

Commit e302bdb

Browse files
ankur-archclaude
andcommitted
Getting started: eliminate expand/collapse layout shifts in the hero
- GetStartedTabs: both tab panels share a fixed height with internal scrolling, so AI Prompt <-> CLI switching no longer shifts the page; the prompt is always visible (no View prompt toggle) with the click-to-copy affordance kept, and the caption is a static footer - AgentPrompt: expanded body is bounded (max-h + scroll) so View expands by a fixed amount instead of the full prompt height - getting-started: note that --env .env is per-deployment and point to project env vars for persistence (CodeRabbit follow-up) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c029607 commit e302bdb

2 files changed

Lines changed: 15 additions & 28 deletions

File tree

apps/docs/content/docs/(index)/getting-started.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ Once your app runs locally, [Prisma Compute](/compute) (currently in Public Beta
4141

4242
1. Sign in with `npx @prisma/cli@latest auth login`.
4343
2. Run `npx @prisma/cli@latest app deploy` from your app directory to get a live URL, adding `--env .env` so environment variables like `DATABASE_URL` reach the deployment.
44-
3. Keep deploying from the CLI, or [connect GitHub](/compute/github) to deploy on push.
44+
3. `--env .env` applies to that one deployment. Persist variables for future deploys with `npx @prisma/cli@latest project env add DATABASE_URL --role production`; see [environment variables](/compute/environment-variables).
45+
4. Keep deploying from the CLI, or [connect GitHub](/compute/github) to deploy on push.
4546

4647
The [deploy guide](/prisma-compute/deploy) covers build settings, frameworks, and troubleshooting.
4748

apps/docs/src/components/getting-started.tsx

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ export function AgentPrompt({
117117
ref={bodyRef}
118118
className={cn(
119119
// w-full beats the fumadocs pre's w-max so pre-wrap can take effect,
120-
// matching the hero prompt; prompts read as prose, not code.
121-
"border-t px-3 pb-1 [&_pre]:w-full [&_pre]:whitespace-pre-wrap [&_pre]:text-[0.8rem]",
120+
// matching the hero prompt; prompts read as prose, not code. The
121+
// max-height bounds how far expanding pushes the content below.
122+
"max-h-80 overflow-y-auto border-t px-3 pb-1 [&_pre]:w-full [&_pre]:whitespace-pre-wrap [&_pre]:text-[0.8rem]",
122123
!open && "sr-only",
123124
)}
124125
>
@@ -137,7 +138,6 @@ export function AgentPrompt({
137138
export function GetStartedTabs({ cli, children }: { cli: string; children: ReactNode }) {
138139
const [tab, setTab] = useState<"prompt" | "cli">("prompt");
139140
const promptRef = useRef<HTMLDivElement>(null);
140-
const [expanded, setExpanded] = useState(false);
141141
const [checked, onCopy] = useCopyButton(async () => {
142142
const text = tab === "cli" ? cli : copyText(promptRef.current);
143143
await navigator.clipboard.writeText(text);
@@ -181,7 +181,11 @@ export function GetStartedTabs({ cli, children }: { cli: string; children: React
181181
Copy
182182
</button>
183183
</div>
184-
<div className={cn("border-t px-6 py-5", tab !== "cli" && "hidden")}>
184+
{/* Both panels share a fixed height with internal scrolling, so
185+
switching tabs never shifts the content below the card. */}
186+
<div
187+
className={cn("h-[26rem] overflow-y-auto border-t px-6 py-5", tab !== "cli" && "hidden")}
188+
>
185189
<div className="flex flex-col gap-1.5 font-mono text-sm text-fd-foreground">
186190
{cli.split("\n").map((line, i) =>
187191
line.startsWith("#") ? (
@@ -201,9 +205,7 @@ export function GetStartedTabs({ cli, children }: { cli: string; children: React
201205
</div>
202206
</div>
203207
<div className={cn("border-t", tab !== "prompt" && "hidden")}>
204-
{/* The prompt stays mounted (sr-only when collapsed) so it remains in
205-
the HTML for crawlers and agents even before anyone expands it. */}
206-
<div className={cn("relative px-5 pb-2 pt-1", !expanded && "sr-only")}>
208+
<div className="relative h-[26rem] px-5 pb-2 pt-1">
207209
<div
208210
role="button"
209211
tabIndex={0}
@@ -219,7 +221,7 @@ export function GetStartedTabs({ cli, children }: { cli: string; children: React
219221
>
220222
<div
221223
ref={promptRef}
222-
className="overflow-hidden [&_button]:hidden [&_pre]:w-full [&_pre]:whitespace-pre-wrap [&_pre]:text-[0.78rem] [&_pre]:leading-6"
224+
className="h-full overflow-y-auto [&_button]:hidden [&_pre]:w-full [&_pre]:whitespace-pre-wrap [&_pre]:text-[0.78rem] [&_pre]:leading-6"
223225
>
224226
{children}
225227
</div>
@@ -233,25 +235,9 @@ export function GetStartedTabs({ cli, children }: { cli: string; children: React
233235
</span>
234236
</div>
235237
</div>
236-
<button
237-
className="flex w-full items-center gap-3 px-5 py-3.5 text-start text-sm transition-colors hover:bg-fd-accent/50"
238-
onClick={() => setExpanded((v) => !v)}
239-
aria-expanded={expanded}
240-
>
241-
<span className="grow text-fd-muted-foreground">
242-
{expanded
243-
? "One prompt scaffolds, seeds, migrates, and deploys the whole stack."
244-
: "One prompt scaffolds, seeds, migrates, and deploys the whole stack. Copy it, or read it first."}
245-
</span>
246-
<span className="inline-flex shrink-0 items-center gap-1.5 font-medium text-fd-primary">
247-
{expanded ? (
248-
<ChevronUp className="size-3.5" aria-hidden="true" />
249-
) : (
250-
<ChevronDown className="size-3.5" aria-hidden="true" />
251-
)}
252-
{expanded ? "Hide prompt" : "View prompt"}
253-
</span>
254-
</button>
238+
</div>
239+
<div className="border-t px-5 py-3 text-sm text-fd-muted-foreground">
240+
One journey scaffolds, seeds, migrates, and deploys the whole stack.
255241
</div>
256242
</div>
257243
);

0 commit comments

Comments
 (0)