Files
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

124 lines
4.0 KiB
TypeScript

import { PermissionAction } from '@supabase/shared-types/out/constants'
import { Edit2, MoreVertical, Trash } from 'lucide-react'
import { toast } from 'sonner'
import {
Button,
copyToClipboard,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
TableCell,
TableRow,
Tooltip,
TooltipContent,
TooltipTrigger,
} from 'ui'
import { TimestampInfo } from 'ui-patterns/TimestampInfo'
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
import type { ProjectSecret } from '@/data/secrets/secrets-query'
import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
interface EdgeFunctionSecretProps {
secret: ProjectSecret
onSelectDelete: () => void
onSelectEdit: () => void
}
const EdgeFunctionSecret = ({ secret, onSelectEdit, onSelectDelete }: EdgeFunctionSecretProps) => {
const { can: canUpdateSecrets } = useAsyncCheckPermissions(PermissionAction.SECRETS_WRITE, '*')
return (
<TableRow>
<TableCell>
<Tooltip>
<TooltipTrigger
onClick={() => {
copyToClipboard(secret.name)
toast.success(`Copied ${secret.name}`)
}}
>
<p className="truncate py-1">
<code className="text-code-inline">{secret.name}</code>
</p>
</TooltipTrigger>
<TooltipContent side="bottom">Click to copy</TooltipContent>
</Tooltip>
</TableCell>
<TableCell>
<p className="max-w-96 truncate" title={secret.value}>
<code className="text-code-inline text-foreground-light!">{secret.value}</code>
</p>
</TableCell>
<TableCell>
{!!secret.updated_at ? (
<TimestampInfo
displayAs="utc"
utcTimestamp={secret.updated_at}
labelFormat="DD MMM YYYY HH:mm:ss (ZZ)"
className="text-sm! text-foreground-light whitespace-nowrap"
/>
) : (
'-'
)}
</TableCell>
<TableCell>
<div className="flex items-center justify-end">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button aria-label="More options" className="px-1" icon={<MoreVertical />} />
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="end" className="w-52">
<DropdownMenuItem asChild>
<ButtonTooltip
variant="text"
icon={<Edit2 size={14} />}
className="w-full justify-start group text-inherit"
disabled={!canUpdateSecrets}
onClick={() => onSelectEdit()}
tooltip={{
content: {
side: 'bottom',
text: !canUpdateSecrets
? 'You need additional permissions to edit edge function secrets'
: undefined,
},
}}
>
Edit secret
</ButtonTooltip>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem asChild>
<ButtonTooltip
variant="text"
icon={<Trash size={14} className="group-not-disabled:text-destructive" />}
className="w-full justify-start group text-inherit"
disabled={!canUpdateSecrets}
onClick={() => onSelectDelete()}
tooltip={{
content: {
side: 'bottom',
text: !canUpdateSecrets
? 'You need additional permissions to delete edge function secrets'
: undefined,
},
}}
>
Delete secret
</ButtonTooltip>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</TableCell>
</TableRow>
)
}
export default EdgeFunctionSecret