Files
supabase__supabase/apps/studio/components/layouts/AppLayout/OrganizationDropdownCommandContent.tsx
Danny White 476d4a5851 refactor(ui): drop redundant Button variant="default" props (#50161)
## 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
2026-09-11 17:05:26 +10:00

133 lines
3.7 KiB
TypeScript

import { Plus } from 'lucide-react'
import Link from 'next/link'
import {
Button,
cn,
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandList,
CommandSeparator,
ScrollArea,
} from 'ui'
import { OrgCommandItem } from './OrgCommandItem'
import { CommandItemLink } from '@/components/ui/CommandItemLink'
import type { Organization } from '@/types'
export interface OrganizationDropdownCommandContentProps {
embedded: boolean
className?: string
organizations: Organization[]
selectedSlug: string | undefined
routePathname: string
hasRouteSlug: boolean
organizationCreationEnabled: boolean
onClose: () => void
}
export function OrganizationDropdownCommandContent({
embedded,
className,
organizations,
selectedSlug,
routePathname,
hasRouteSlug,
organizationCreationEnabled,
onClose,
}: OrganizationDropdownCommandContentProps) {
const orgList = (
<>
{organizations?.map((org) => (
<OrgCommandItem
key={org.slug}
org={org}
selectedSlug={selectedSlug}
routePathname={routePathname}
hasRouteSlug={hasRouteSlug}
onClose={onClose}
compactPadding={!embedded}
/>
))}
</>
)
if (embedded) {
return (
<Command className={cn(className, 'flex flex-col flex-1 min-h-0 overflow-hidden')}>
<div className="flex items-center gap-2 shrink-0 border-b p-2">
<Button variant="text" block size="small" asChild>
<Link
href="/organizations"
className="text-xs text-foreground-light hover:text-foreground"
onClick={onClose}
>
All Organizations
</Link>
</Button>
{organizationCreationEnabled && (
<Button block size="small" asChild icon={<Plus size={14} strokeWidth={1.5} />}>
<Link
href="/new"
className="text-xs text-foreground-light hover:text-foreground"
onClick={onClose}
>
New organization
</Link>
</Button>
)}
</div>
<CommandInput
placeholder="Find organization..."
wrapperClassName="shrink-0"
className="text-base sm:text-sm"
/>
<CommandList className="flex flex-col flex-1 min-h-0 overflow-y-auto p-1 max-h-none!">
<CommandEmpty>No organizations found</CommandEmpty>
<CommandGroup className="min-h-0">{orgList}</CommandGroup>
</CommandList>
</Command>
)
}
return (
<Command className={className}>
<CommandInput placeholder="Find organization..." />
<CommandList>
<CommandEmpty>No organizations found</CommandEmpty>
<CommandGroup>
<ScrollArea className={(organizations || []).length > 7 ? 'md:h-[210px]' : ''}>
{orgList}
</ScrollArea>
</CommandGroup>
<CommandSeparator />
<CommandGroup>
<CommandItemLink
href="/organizations"
className="cursor-pointer w-full gap-2"
onSelect={onClose}
>
All Organizations
</CommandItemLink>
</CommandGroup>
{organizationCreationEnabled && (
<>
<CommandSeparator />
<CommandGroup>
<CommandItemLink
href="/new"
className="cursor-pointer w-full gap-2"
onSelect={onClose}
>
<Plus size={14} strokeWidth={1.5} />
<p>New organization</p>
</CommandItemLink>
</CommandGroup>
</>
)}
</CommandList>
</Command>
)
}