mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
Moves Explorer’s back navigation and create actions into a reusable sidebar breadcrumb header. Reduces product-menu headings globally to `text-sm` and keeps breadcrumb links free of padding, borders, and backgrounds. ### How to test 1. Open `/project/<ref>/explorer` and confirm the header shows Explorer and the SQL Editor switch action. 2. Open Notebooks and Chats. Confirm the header shows `Explorer > Notebooks/Chats` and the corresponding create action works. 3. Return using the Explorer breadcrumb with a click or Tab + Enter. Check that the label stays aligned and has no hover background. 4. Open another product, such as Database, and confirm its sidebar heading uses the smaller font size. 5. At a mobile viewport, open the menu and repeat the notebook/chat actions and back navigation without closing the sheet. Confirm the header stays current and disappears when returning to the main menu or opening another product. Validation: 18 focused tests, typecheck, formatting, and lint ratchet passed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a shared Explorer sidebar header with breadcrumbs and contextual actions for creating notebooks and chats. - Added keyboard-accessible navigation between the Explorer overview and notebook or chat sections. - Added support for customized product menu headers across project layouts. - **Improvements** - Centralized Explorer navigation and actions in the shared sidebar layout. - Improved mobile menu updates when navigating between Explorer resources. - Refined Explorer home layout and drag-handle behavior across screen sizes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { PropsWithChildren, ReactNode } from 'react'
|
|
import { cn } from 'ui'
|
|
|
|
interface ProductMenuBarProps {
|
|
title: string
|
|
titleBadge?: ReactNode
|
|
header?: ReactNode
|
|
className?: string
|
|
}
|
|
|
|
export const ProductMenuBarHeader = ({ children }: PropsWithChildren) => (
|
|
<div className="border-default flex shrink-0 min-h-(--header-height) items-center gap-2 border-b px-6 justify-between">
|
|
{children}
|
|
</div>
|
|
)
|
|
|
|
export const ProductMenuBar = ({
|
|
title,
|
|
titleBadge,
|
|
header,
|
|
children,
|
|
className,
|
|
}: PropsWithChildren<ProductMenuBarProps>) => {
|
|
return (
|
|
<div
|
|
/**
|
|
* id used in playwright-tests/tests/snapshot/spec/table-editor.spec.ts
|
|
* */
|
|
id="spec-click-target"
|
|
className={cn(
|
|
'flex flex-col w-full h-full', // Layout
|
|
'hide-scrollbar bg-dash-sidebar border-default'
|
|
)}
|
|
>
|
|
<ProductMenuBarHeader>
|
|
{header ?? (
|
|
<>
|
|
<h4 className="text-sm truncate min-w-0 flex-1">{title}</h4>
|
|
{titleBadge}
|
|
</>
|
|
)}
|
|
</ProductMenuBarHeader>
|
|
<div className={cn('grow overflow-y-auto', className)}>{children}</div>
|
|
</div>
|
|
)
|
|
}
|