Files
supabase/apps/docs/components/HomePageCover.tsx
T
Danny White 5712eefe06 fix(docs): polish homepage AI setup prompt (#48318)
## What kind of change does this PR introduce?

Bug fix / docs UI polish.

## What is the current behavior?

The homepage AI Prompt panel:

- Has an `expandable` feature but its overflow contents are ~1 line
extra
- Expanding it affects the cover height and causes layout shift
- Below `xl`, the hero stacked and the logo sat alone above the title on
small screens.

## What is the new behavior?

- Shows the full AI setup prompt by default and removes the unused
`expandable` machinery from `PromptPanel`
- Keeps both tab panes in a shared grid cell so the panel height stays
stable when switching tabs
- Keeps logo + title in a row at all sizes, and starts the side-by-side
hero (copy + prompt) at `lg` instead of `xl`

| Before | After |
| --- | --- |
| <img width="1279" height="722" alt="15728"
src="https://github.com/user-attachments/assets/c61fdbbc-706c-47cf-8b47-4245d4c96215"
/> | <img width="1280" height="722" alt="Supabase Docs"
src="https://github.com/user-attachments/assets/ab3a97a4-d725-4d9e-92bf-6f564a22f1bd"
/> |
| <img width="1279" height="722" alt="Supabase Docs"
src="https://github.com/user-attachments/assets/42906c4b-4f82-4fbc-8bab-3f5d9530aa54"
/> | <img width="1280" height="722" alt="Supabase Docs"
src="https://github.com/user-attachments/assets/177a17d7-536c-4bd6-a8d0-1a2bc10f3ac9"
/> |
| <img width="1012" height="722" alt="96312"
src="https://github.com/user-attachments/assets/032a3b43-078f-4d13-a67d-9a36c76a9be5"
/> | <img width="1012" height="722" alt="Supabase Docs"
src="https://github.com/user-attachments/assets/f3ff3c0a-6df8-4e61-bfcb-ab99e99cccea"
/> |

## To test

Play around with the docs homepage AI Prompt panel on the Vercel preview
at various breakpoints:
https://docs-git-dnywh-docs-ai-prompt-expanded-supabase.vercel.app/

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Improved prompt panel tab navigation with manual activation for more
predictable switching and enhanced accessibility.
- Inactive tab panels now remain mounted while reflecting
active/inactive state for smoother transitions.

- **Style**
- Refined the documentation homepage cover layout, including responsive
alignment, logo sizing behavior, and updated heading/paragraph spacing.
- Updated setup prompt presentation and refined expandable prompt sizing
and control styling.

- **Bug Fixes**
- Inactive prompt content is now hidden and non-interactive, preventing
unintended interaction.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-29 06:24:37 +10:00

84 lines
3.2 KiB
TypeScript

'use client'
import {
Prompt,
PromptContent,
PromptCopy,
PromptPanel,
PromptTitle,
} from '~/features/ui/PromptPanel'
import { isFeatureEnabled } from 'common'
import { Sparkles, Terminal } from 'lucide-react'
import { type ReactNode } from 'react'
import { getCustomContent } from '../lib/custom-content/getCustomContent'
import DocsCoverLogo from './DocsCoverLogo'
import { setupCommand, setupCommands, setupPrompt } from './HomePageCover.constants'
const fullGettingStartedEnabled = isFeatureEnabled('docs:full_getting_started')
function SetupPrompt({ cliCode }: { cliCode: ReactNode }) {
return (
<PromptPanel>
<Prompt value="prompt">
<PromptTitle icon={<Sparkles />}>AI Prompt</PromptTitle>
<PromptCopy>{setupPrompt}</PromptCopy>
<PromptContent>
Help me get set up with Supabase. Do the following: 1. Install the Supabase CLI globally
with{' '}
<code className="shimmer-none rounded bg-surface-200 px-1 py-0.5 font-mono text-xs text-foreground">
{setupCommand.installCli}
</code>
. 2. Install the Supabase Plugin with{' '}
<code className="shimmer-none rounded bg-surface-200 px-1 py-0.5 font-mono text-xs text-foreground">
{setupCommand.installPlugin}
</code>
. 3. Review my project and determine whether Supabase is already initialized. If it is not
initialized, run{' '}
<code className="shimmer-none rounded bg-surface-200 px-1 py-0.5 font-mono text-xs text-foreground">
{setupCommand.initialize}
</code>
. 4. Suggest the most relevant next steps.
</PromptContent>
</Prompt>
<Prompt value="cli">
<PromptTitle icon={<Terminal />}>CLI</PromptTitle>
<PromptCopy>{setupCommands}</PromptCopy>
<PromptContent shimmer={false}>{cliCode}</PromptContent>
</Prompt>
</PromptPanel>
)
}
const HomePageCover = ({ title, cliCode }: { title: string; cliCode: ReactNode }) => {
const { homepageHeading } = getCustomContent(['homepage:heading'])
return (
<div className="w-full border-b bg-muted/10">
<div className="mx-auto max-w-7xl px-6 py-16">
<div className="flex flex-col gap-10 lg:flex-row lg:items-center lg:gap-12 xl:gap-16">
<div className="flex w-full min-w-0 flex-1 items-center gap-4 sm:gap-8">
<DocsCoverLogo aria-hidden="true" className="w-12 shrink-0 sm:w-[60px] md:w-[100px]" />
<div className="flex min-w-0 flex-col">
<h1 className="m-0 text-3xl text-foreground sm:text-4xl">
{homepageHeading || title}
</h1>
<p className="m-0 mt-2 text-base leading-7 text-foreground-light sm:mt-3 sm:text-xl">
Learn how to get up and running with Supabase through tutorials, APIs and platform
resources.
</p>
</div>
</div>
{fullGettingStartedEnabled && (
<div className="w-full lg:max-w-[478px] lg:shrink-0">
<SetupPrompt cliCode={cliCode} />
</div>
)}
</div>
</div>
</div>
)
}
export default HomePageCover