Files
supabase/apps/studio/components/layouts/AppLayout/OrganizationDropdownCommandContent.tsx
Danny White 000320e914 fix(studio): keep form text consistent across breakpoints (#53429)
## Problem

Small and medium form controls and related text grow from 14px to 16px
below a viewport breakpoint, making them larger than surrounding
dashboard text.

## Solution

Keep these sizes at 14px across breakpoints in shared controls and form
layouts, plus Studio search fields and assistant textareas. Explicit
large and extra-large variants keep their existing sizes. The shared
sizing change also applies to buttons.

```diff
- text-base md:text-sm
+ text-sm
```

This accepts iOS Safari’s automatic zoom when focusing smaller editable
fields. User zoom remains available.

Validation: Prettier, scoped Studio ESLint, and whitespace checks pass.
Browser checks and a full build have not been run.

## Review instructions

1. Open a project’s **Settings > General**. Resize across 768px and
check that field text, labels, helper text, and buttons keep the same
font size.
2. Open the organisation/project selector and resize across 640px. Its
search text should stay at 14px.
3. Open the assistant and check that its textarea text stays the same
size across 768px.
4. On an iPhone, focus an editable field and check that the accepted
focus zoom behaviour remains usable.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
2026-11-16 09:56:27 +11:00

132 lines
3.6 KiB
TypeScript

import { PlusIcon } 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}
/>
))}
</>
)
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="outline" 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={<PlusIcon 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-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}
>
<PlusIcon size={14} strokeWidth={1.5} />
<p>New organization</p>
</CommandItemLink>
</CommandGroup>
</>
)}
</CommandList>
</Command>
)
}