mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem - docs top bar holds the global nav menus, so it repeats what the new sidebar shows - redesign needs a top bar with a breadcrumb for the current page and room for the page actions ## Solution - replaces the top bar with a logo cell, a breadcrumb, the page actions and an account cell - adds a sections menu under the logo, so a reader moves between docs, reference and the knowledge base - adds a breadcrumb slot for the current heading, which the right rail fills in #PR5, and a reference version dropdown - replaces the search field with an icon button, and shows ⌘K and ⌘I in the search and ask ai tooltips - adds a legacy copy of the current top bar, so the flag can show it merge the stack together, because the new top bar shows for every reader until #PR5 adds the flag switch <!-- ## Preview links If relevant, include links to changed pages for easy review access. Copy the preview base URL from the Vercel bot comment on this PR. Use the following table as an example template. | Site | Live | Preview | Search for | | -------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------- | | WWW | [/blog/your-post](https://supabase.com/blog/your-post) | [/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post) | unique phrase from the change | | Docs | [/docs/guides/your-page](https://supabase.com/docs/guides/your-page) | [/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page) | unique phrase from the change | | Studio | [/dashboard](https://supabase.com/dashboard) | [/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard) | unique phrase from the change | | Design system | [/design-system](https://supabase.com/design-system) | [/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system) | unique phrase from the change | | UI library | [/library](https://supabase.com/library) | [/library](https://ui-library-git-branch-name-supabase.vercel.app/library) | unique phrase from the change | | Knowledge base | [/kb/guides/your-page](https://supabase.com/kb/guides/your-page) | [/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page) | unique phrase from the change | --> <!-- ## Additional context Optionally add any other context or screenshots. --> ## Review instructions 1. open [/docs/guides/database/overview](https://docs-git-antlio-docs-v2-4-top-bar-supabase.vercel.app/docs/guides/database/overview) 2. make sure that the breadcrumb shows Database and the page 3. open [/docs/reference/javascript/introduction](https://docs-git-antlio-docs-v2-4-top-bar-supabase.vercel.app/docs/reference/javascript/introduction), and make sure that the breadcrumb has a version dropdown after JavaScript ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
83 lines
2.2 KiB
TypeScript
83 lines
2.2 KiB
TypeScript
'use client'
|
|
|
|
import { ChevronDown } from 'lucide-react'
|
|
import { useRouter } from 'next/navigation'
|
|
|
|
import {
|
|
Badge,
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuTrigger,
|
|
} from 'ui'
|
|
|
|
import { REFERENCES } from '~/content/navigation.references'
|
|
|
|
const RevVersionDropdown = ({
|
|
library,
|
|
currentVersion,
|
|
}: {
|
|
library: string
|
|
currentVersion: string
|
|
}) => {
|
|
const { push } = useRouter()
|
|
|
|
const libraryMeta = REFERENCES?.[library] ?? undefined
|
|
const versions = libraryMeta?.versions ?? []
|
|
|
|
if (!versions || versions.length <= 1) {
|
|
return null
|
|
}
|
|
|
|
const onSelectVersion = (version: string) => {
|
|
if (version === versions[0]) {
|
|
push(`/reference/${library}`)
|
|
} else {
|
|
push(`/reference/${library}/${version}`)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger>
|
|
<div
|
|
className="
|
|
group
|
|
justify-between
|
|
bg-control
|
|
border
|
|
hover:border-control
|
|
hover:bg-overlay-hover
|
|
border-control px-2 h-[32px] rounded-sm
|
|
layout-v2:h-6 layout-v2:px-1.5 layout-v2:rounded-md
|
|
font-mono
|
|
flex items-center gap-1 text-foreground-muted text-xs group-hover:text-foreground transition
|
|
"
|
|
>
|
|
<span className="text-foreground text-sm layout-v2:text-xs group-hover:text-foreground transition">
|
|
{currentVersion}.0
|
|
</span>
|
|
<ChevronDown size={14} strokeWidth={2} />
|
|
</div>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="start" side="bottom" className="w-48">
|
|
<DropdownMenuLabel className="text-xs">Stable releases</DropdownMenuLabel>
|
|
{versions.map((version, index) => (
|
|
<DropdownMenuItem
|
|
key={version}
|
|
onClick={() => onSelectVersion(version)}
|
|
className="justify-between flex"
|
|
>
|
|
<span className={`${currentVersion === version ? 'font-bold' : ''}`}>
|
|
Version {version}.0
|
|
</span>
|
|
{index === 0 && <Badge>Latest</Badge>}
|
|
</DropdownMenuItem>
|
|
))}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|
|
export default RevVersionDropdown
|