mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00: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
119 lines
2.8 KiB
TypeScript
119 lines
2.8 KiB
TypeScript
'use client'
|
|
|
|
import {
|
|
ArrowUpCircle,
|
|
CheckCircle2,
|
|
Circle,
|
|
HelpCircle,
|
|
LucideIcon,
|
|
Plus,
|
|
XCircle,
|
|
} from 'lucide-react'
|
|
import * as React from 'react'
|
|
import {
|
|
Button,
|
|
Command,
|
|
CommandEmpty,
|
|
CommandGroup,
|
|
CommandInput,
|
|
CommandItem,
|
|
CommandList,
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverTrigger,
|
|
} from 'ui'
|
|
|
|
import { cn } from '@/lib/utils'
|
|
|
|
type Status = {
|
|
value: string
|
|
label: string
|
|
icon: LucideIcon
|
|
}
|
|
|
|
const statuses: Status[] = [
|
|
{
|
|
value: 'backlog',
|
|
label: 'Backlog',
|
|
icon: HelpCircle,
|
|
},
|
|
{
|
|
value: 'todo',
|
|
label: 'Todo',
|
|
icon: Circle,
|
|
},
|
|
{
|
|
value: 'in progress',
|
|
label: 'In Progress',
|
|
icon: ArrowUpCircle,
|
|
},
|
|
{
|
|
value: 'done',
|
|
label: 'Done',
|
|
icon: CheckCircle2,
|
|
},
|
|
{
|
|
value: 'canceled',
|
|
label: 'Canceled',
|
|
icon: XCircle,
|
|
},
|
|
]
|
|
|
|
export default function ComboboxPopover() {
|
|
const [open, setOpen] = React.useState(false)
|
|
const [selectedStatus, setSelectedStatus] = React.useState<Status | null>(null)
|
|
|
|
return (
|
|
<div className="flex items-center gap-4">
|
|
<p className="text-sm text-muted-foreground">Status</p>
|
|
<Popover open={open} onOpenChange={setOpen}>
|
|
<PopoverTrigger asChild>
|
|
<Button
|
|
size="small"
|
|
className="w-[150px] justify-start rounded-full"
|
|
icon={
|
|
selectedStatus ? (
|
|
<selectedStatus.icon className="mr-2 h-4 w-4 shrink-0" />
|
|
) : (
|
|
<Plus className="mr-2 h-4 w-4 shrink-0 text-foreground-muted" />
|
|
)
|
|
}
|
|
>
|
|
{selectedStatus ? <>{selectedStatus.label}</> : <>Set status</>}
|
|
</Button>
|
|
</PopoverTrigger>
|
|
<PopoverContent className="p-0" side="right" align="start">
|
|
<Command>
|
|
<CommandInput placeholder="Change status..." />
|
|
<CommandList>
|
|
<CommandEmpty>No results found.</CommandEmpty>
|
|
<CommandGroup>
|
|
{statuses.map((status) => (
|
|
<CommandItem
|
|
key={status.value}
|
|
value={status.value}
|
|
onSelect={(value) => {
|
|
setSelectedStatus(
|
|
statuses.find((priority) => priority.value === value) || null
|
|
)
|
|
setOpen(false)
|
|
}}
|
|
>
|
|
<status.icon
|
|
className={cn(
|
|
'mr-2 h-4 w-4',
|
|
status.value === selectedStatus?.value ? 'opacity-100' : 'opacity-40'
|
|
)}
|
|
/>
|
|
<span>{status.label}</span>
|
|
</CommandItem>
|
|
))}
|
|
</CommandGroup>
|
|
</CommandList>
|
|
</Command>
|
|
</PopoverContent>
|
|
</Popover>
|
|
</div>
|
|
)
|
|
}
|