mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
## What kind of change does this PR introduce? Mechanical cleanup on top of the Button default-variant change (#50160). ## What is the current behavior? Many callsites still pass `variant="default"` even though that is now the component default. ## What is the new behavior? Removes redundant static `variant="default"` from legacy `Button` and `ButtonTooltip` callsites. Keeps explicit defaults where they document the API: - `button-default.tsx` and `button-sizes.tsx` demos - `DocsButton`, which pins neutral styling at the wrapper boundary ## To test Studio: - [Auth → Rate Limits](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/auth/rate-limits): dirty the form so Cancel appears; Cancel stays neutral, Save stays green - [Project Settings → API Keys](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/settings/api-keys): `DocsButton` in the header actions stays neutral Design system: - [Design system → Button](https://design-system-git-dnywh-dc924ac1-supabase.vercel.app/design-system/docs/components/button): `button-default` / `button-sizes` still show explicit default styling; Primary (green) is restricted to the Primary section (and `asChild`) WWW: - [www → Brand assets](https://zone-www-dot-com-git-dnywh-dc924ac1-supabase.vercel.app/brand-assets): Download logo kit / Download button kit stay neutral
92 lines
3.8 KiB
TypeScript
92 lines
3.8 KiB
TypeScript
import { useParams } from 'common'
|
|
import { ChevronLeft, Menu } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { useState } from 'react'
|
|
import { Button, cn } from 'ui'
|
|
import { MobileSheetNav } from 'ui-patterns/MobileSheetNav'
|
|
|
|
import { HomeIcon } from '../LayoutHeader/HomeIcon'
|
|
import { useMobileSheet } from './MobileSheetContext'
|
|
import { OrgSelector } from './OrgSelector'
|
|
import { ProjectBranchSelector } from './ProjectBranchSelector'
|
|
import { ConnectButton } from '@/components/interfaces/ConnectButton/ConnectButton'
|
|
import { LocalDropdown } from '@/components/interfaces/LocalDropdown'
|
|
import { SidebarContent } from '@/components/interfaces/Sidebar'
|
|
import { UserDropdown } from '@/components/interfaces/UserDropdown'
|
|
import { FloatingMobileToolbar } from '@/components/layouts/Navigation/FloatingMobileToolbar/FloatingMobileToolbar'
|
|
import { useOrganizationsQuery } from '@/data/organizations/organizations-query'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
import { IS_PLATFORM } from '@/lib/constants'
|
|
|
|
export const ICON_SIZE = 20
|
|
export const ICON_STROKE_WIDTH = 1.5
|
|
|
|
export const MobileNavigationBar = ({
|
|
hideMobileMenu,
|
|
backToDashboardURL,
|
|
}: {
|
|
hideMobileMenu?: boolean
|
|
backToDashboardURL?: string
|
|
}) => {
|
|
const [isSheetOpen, setIsSheetOpen] = useState(false)
|
|
const { ref: projectRef, slug } = useParams()
|
|
const { data: selectedOrganization } = useSelectedOrganizationQuery()
|
|
const { isPending: isLoadingOrganizations } = useOrganizationsQuery()
|
|
const isProjectScope = !!projectRef
|
|
const showOrgSelection = slug || isLoadingOrganizations || (selectedOrganization && projectRef)
|
|
const { openMenu } = useMobileSheet()
|
|
|
|
return (
|
|
<div className="w-full flex flex-row md:hidden">
|
|
<nav
|
|
className={cn(
|
|
'group pr-3 pl-2 z-10 w-full h-12 gap-2',
|
|
'border-b bg-dash-sidebar border-default shadow-[0_0_30px_0_rgba(0,0,0,0.07)]',
|
|
'transition-width duration-200',
|
|
'hide-scrollbar flex flex-row items-center justify-between overflow-x-auto'
|
|
)}
|
|
>
|
|
<div className={cn('flex min-w-0 shrink items-center gap-2', !IS_PLATFORM && 'pl-2')}>
|
|
{backToDashboardURL && (
|
|
<div className="flex items-center justify-center ml-1 flex-0 md:hidden h-full aspect-square">
|
|
<Link
|
|
href={backToDashboardURL}
|
|
className="flex items-center justify-center bg-transparent! rounded-md min-w-[30px] w-[30px] h-[30px] border text-foreground-lighter hover:text-foreground transition-colors"
|
|
>
|
|
<ChevronLeft strokeWidth={1.5} size={16} />
|
|
</Link>
|
|
</div>
|
|
)}
|
|
{!IS_PLATFORM && <HomeIcon />}
|
|
{isProjectScope ? (
|
|
<>
|
|
<ProjectBranchSelector />
|
|
<ConnectButton iconOnly className="w-8 h-8" />
|
|
</>
|
|
) : IS_PLATFORM && showOrgSelection ? (
|
|
<OrgSelector />
|
|
) : (
|
|
<HomeIcon className="ml-1" />
|
|
)}
|
|
</div>
|
|
<div className="flex shrink-0 gap-2">
|
|
{IS_PLATFORM ? <UserDropdown /> : <LocalDropdown />}
|
|
{!hideMobileMenu && (
|
|
<Button
|
|
aria-label="Open menu"
|
|
title="Menu dropdown button"
|
|
className="flex lg:hidden border-default bg-surface-100/75 text-foreground-light rounded-md min-w-[30px] w-[30px] h-[30px] data-open:bg-overlay-hover/30"
|
|
icon={<Menu />}
|
|
onClick={() => openMenu()}
|
|
/>
|
|
)}
|
|
</div>
|
|
</nav>
|
|
<MobileSheetNav open={isSheetOpen} onOpenChange={setIsSheetOpen} data-state="expanded">
|
|
<SidebarContent />
|
|
</MobileSheetNav>
|
|
<FloatingMobileToolbar hideMobileMenu={hideMobileMenu} />
|
|
</div>
|
|
)
|
|
}
|