mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +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)
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
'use client'
|
|
|
|
import { SearchTrigger, type SearchTriggerProps } from 'docs-search/components'
|
|
import { Search } from 'lucide-react'
|
|
import { Button, cn, KeyboardShortcut, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
|
|
|
import { SEARCH_SHORTCUT_KEY } from './constants'
|
|
import { useSearchV2 } from './SearchV2Provider'
|
|
|
|
type SearchV2TriggerProps = Pick<SearchTriggerProps, 'className' | 'placeholder'>
|
|
|
|
export function SearchV2Trigger({ className, placeholder }: SearchV2TriggerProps) {
|
|
const { isSearchOpen, showSearch } = useSearchV2()
|
|
|
|
return (
|
|
<SearchTrigger
|
|
className={className}
|
|
placeholder={placeholder}
|
|
expanded={isSearchOpen}
|
|
onClick={() => showSearch('search_input')}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export const SearchV2IconTrigger = ({ className }: { className?: string }) => {
|
|
const { isSearchOpen, showSearch } = useSearchV2()
|
|
|
|
const handleClick = () => showSearch('search_input')
|
|
|
|
return (
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Button
|
|
aria-label="Search docs"
|
|
aria-haspopup="dialog"
|
|
aria-expanded={isSearchOpen}
|
|
aria-keyshortcuts={`Meta+${SEARCH_SHORTCUT_KEY} Control+${SEARCH_SHORTCUT_KEY}`}
|
|
onClick={handleClick}
|
|
icon={<Search />}
|
|
className={cn('size-7.5 shrink-0 px-0', className)}
|
|
/>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="bottom" className="flex items-center gap-2">
|
|
{/* the button label already names it, so the tooltip description adds only the shortcut */}
|
|
<span aria-hidden>Search docs</span>
|
|
<KeyboardShortcut keys={['Meta', SEARCH_SHORTCUT_KEY]} variant="keycaps" />
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
)
|
|
}
|