mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Align borders to match header heights. <img width="2904" height="1734" alt="shot_2026-02-04_at_08 42 21z_2x" src="https://github.com/user-attachments/assets/0538f8eb-64a5-4329-94fb-3ea4feed847d" />
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import { useParams } from 'common'
|
|
import { usePathname } from 'next/navigation'
|
|
import { ComponentProps, ReactNode } from 'react'
|
|
import { useTabsStateSnapshot } from 'state/tabs'
|
|
import { cn } from 'ui'
|
|
|
|
import { ProjectLayoutWithAuth } from '../ProjectLayout'
|
|
import { CollapseButton } from '../Tabs/CollapseButton'
|
|
import { EditorTabs } from '../Tabs/Tabs'
|
|
import { useEditorType } from './EditorsLayout.hooks'
|
|
|
|
export interface ExplorerLayoutProps extends ComponentProps<typeof ProjectLayoutWithAuth> {
|
|
children: ReactNode
|
|
title?: string
|
|
product?: string
|
|
productMenuClassName?: string
|
|
}
|
|
|
|
export const EditorBaseLayout = ({
|
|
children,
|
|
title,
|
|
product,
|
|
productMenuClassName,
|
|
productMenu,
|
|
}: ExplorerLayoutProps) => {
|
|
const { ref } = useParams()
|
|
const pathname = usePathname()
|
|
const editor = useEditorType()
|
|
const tabs = useTabsStateSnapshot()
|
|
|
|
const hasNoOpenTabs =
|
|
editor === 'table' ? tabs.openTabs.filter((x) => !x.startsWith('sql')).length === 0 : false
|
|
const hideTabs =
|
|
pathname === `/project/${ref}/editor` || pathname === `/project/${ref}/sql` || hasNoOpenTabs
|
|
|
|
return (
|
|
<ProjectLayoutWithAuth
|
|
resizableSidebar
|
|
title={title}
|
|
product={product}
|
|
productMenuClassName={productMenuClassName}
|
|
productMenu={productMenu}
|
|
>
|
|
<div className="flex flex-col h-full">
|
|
<div
|
|
className={cn(
|
|
'h-10 md:min-h-[var(--header-height)] flex items-center',
|
|
!hideTabs ? 'bg-surface-200 dark:bg-alternative' : 'bg-surface-100'
|
|
)}
|
|
>
|
|
{hideTabs ? <CollapseButton hideTabs={hideTabs} /> : <EditorTabs />}
|
|
</div>
|
|
<div className="h-full">{children}</div>
|
|
</div>
|
|
</ProjectLayoutWithAuth>
|
|
)
|
|
}
|