mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem - kb and docs each keep their own copy of the top bar menu and its buttons - the kb bar has no search box, and the docs bar has one on the right ## Solution - adds a shared top nav to `ui-patterns`, so kb and docs use one megamenu and one set of bar buttons - replaces the docs desktop dropdowns with the megamenu, so docs and kb show the same menu design - adds a heading to the first column of each docs menu, so the reader sees which group a list belongs to - adds the search box and a "sign up" button label to the kb bar, so it matches docs | state | preview | | -------|------| | before | <img width="1506" height="350" alt="image" src="https://github.com/user-attachments/assets/3045d400-4ac0-41d7-a94f-acc23fa919fa" /> | | after | <img width="1506" height="350" alt="image" src="https://github.com/user-attachments/assets/334e5130-611a-4eb7-a95a-c796e2bbcf80" /> | <!-- ## 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 the kb and docs preview links above in desktop 2. on kb, hover "topics" and make sure that the panel opens under the bar 3. click the search box and make sure that the kb search dialog opens 4. on docs, open [/docs/guides/auth](https://docs-git-antlio-feat-shared-top-nav-supabase.vercel.app/docs/guides/auth) and make sure that the "products" label has an underline 5. open each docs menu and make sure that the first column has a heading 6. make sure that the menu button opens and closes the mobile menu in kb and docs ## 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)
74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
'use client'
|
|
|
|
import { isFeatureEnabled } from 'common'
|
|
import { useTheme } from 'next-themes'
|
|
import Link from 'next/link'
|
|
import { Fragment } from 'react'
|
|
import { DropdownMenuItem, DropdownMenuSeparator } from 'ui'
|
|
import { TopNavDropdown, TopNavThemeGroup } from 'ui-patterns/TopNav/TopNavDropdown'
|
|
|
|
import MenuIconPicker from './MenuIconPicker'
|
|
|
|
const menu = [
|
|
[
|
|
isFeatureEnabled('docs:navigation_dropdown_links_home')
|
|
? {
|
|
label: 'Supabase.com',
|
|
icon: 'home',
|
|
href: 'https://supabase.com',
|
|
otherProps: {
|
|
target: '_blank',
|
|
rel: 'noreferrer noopener',
|
|
},
|
|
}
|
|
: {
|
|
label: 'Dashboard',
|
|
icon: 'home',
|
|
href: '../dashboard',
|
|
},
|
|
{
|
|
label: 'GitHub',
|
|
icon: 'github',
|
|
href: 'https://github.com/supabase/supabase',
|
|
otherProps: {
|
|
target: '_blank',
|
|
rel: 'noreferrer noopener',
|
|
},
|
|
},
|
|
{
|
|
label: 'Support',
|
|
icon: 'support',
|
|
href: 'https://supabase.com/support',
|
|
otherProps: {
|
|
target: '_blank',
|
|
rel: 'noreferrer noopener',
|
|
},
|
|
},
|
|
],
|
|
]
|
|
|
|
const DocsTopNavDropdown = () => {
|
|
const { theme, setTheme } = useTheme()
|
|
|
|
return (
|
|
<TopNavDropdown>
|
|
{menu.map((menuSection) => (
|
|
<Fragment key={menuSection[0].label}>
|
|
{menuSection.map((sectionItem) => (
|
|
<DropdownMenuItem key={sectionItem.label} asChild className="gap-2">
|
|
<Link href={sectionItem.href} {...sectionItem.otherProps}>
|
|
<MenuIconPicker icon={sectionItem.icon} className="text-foreground-lighter" />
|
|
{sectionItem.label}
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
))}
|
|
<DropdownMenuSeparator />
|
|
</Fragment>
|
|
))}
|
|
<TopNavThemeGroup value={theme} onValueChange={setTheme} />
|
|
</TopNavDropdown>
|
|
)
|
|
}
|
|
|
|
export default DocsTopNavDropdown
|