mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-07 14:08:47 +00:00
* feat(www): add login blocks * chore(www): restructure for blocks * chore: build registry * chore: clean up chunks * fix(www): chart categories * feat(www): big registry refactor * feat(www): update blocks * feat: complex blocks * fix: update schema * feat: sync new-york and default * fix: lint * feat: move charts * fix(www): code * fix: src path * chore: rebuild registry * fix: screenshot * fix: set new-york as default
112 lines
3.3 KiB
TypeScript
112 lines
3.3 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { Calendar, MoreHorizontal, Tags, Trash, User } from "lucide-react"
|
|
|
|
import { Button } from "@/registry/default/ui/button"
|
|
import {
|
|
Command,
|
|
CommandEmpty,
|
|
CommandGroup,
|
|
CommandInput,
|
|
CommandItem,
|
|
CommandList,
|
|
} from "@/registry/default/ui/command"
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuGroup,
|
|
DropdownMenuItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuShortcut,
|
|
DropdownMenuSub,
|
|
DropdownMenuSubContent,
|
|
DropdownMenuSubTrigger,
|
|
DropdownMenuTrigger,
|
|
} from "@/registry/default/ui/dropdown-menu"
|
|
|
|
const labels = [
|
|
"feature",
|
|
"bug",
|
|
"enhancement",
|
|
"documentation",
|
|
"design",
|
|
"question",
|
|
"maintenance",
|
|
]
|
|
|
|
export default function ComboboxDropdownMenu() {
|
|
const [label, setLabel] = React.useState("feature")
|
|
const [open, setOpen] = React.useState(false)
|
|
|
|
return (
|
|
<div className="flex w-full flex-col items-start justify-between rounded-md border px-4 py-3 sm:flex-row sm:items-center">
|
|
<p className="text-sm font-medium leading-none">
|
|
<span className="mr-2 rounded-lg bg-primary px-2 py-1 text-xs text-primary-foreground">
|
|
{label}
|
|
</span>
|
|
<span className="text-muted-foreground">Create a new project</span>
|
|
</p>
|
|
<DropdownMenu open={open} onOpenChange={setOpen}>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button variant="ghost" size="sm">
|
|
<MoreHorizontal />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="end" className="w-[200px]">
|
|
<DropdownMenuLabel>Actions</DropdownMenuLabel>
|
|
<DropdownMenuGroup>
|
|
<DropdownMenuItem>
|
|
<User />
|
|
Assign to...
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem>
|
|
<Calendar />
|
|
Set due date...
|
|
</DropdownMenuItem>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuSub>
|
|
<DropdownMenuSubTrigger>
|
|
<Tags />
|
|
Apply label
|
|
</DropdownMenuSubTrigger>
|
|
<DropdownMenuSubContent className="p-0">
|
|
<Command>
|
|
<CommandInput
|
|
placeholder="Filter label..."
|
|
autoFocus={true}
|
|
/>
|
|
<CommandList>
|
|
<CommandEmpty>No label found.</CommandEmpty>
|
|
<CommandGroup>
|
|
{labels.map((label) => (
|
|
<CommandItem
|
|
key={label}
|
|
value={label}
|
|
onSelect={(value) => {
|
|
setLabel(value)
|
|
setOpen(false)
|
|
}}
|
|
>
|
|
{label}
|
|
</CommandItem>
|
|
))}
|
|
</CommandGroup>
|
|
</CommandList>
|
|
</Command>
|
|
</DropdownMenuSubContent>
|
|
</DropdownMenuSub>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem className="text-red-600">
|
|
<Trash />
|
|
Delete
|
|
<DropdownMenuShortcut>⌘⌫</DropdownMenuShortcut>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuGroup>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</div>
|
|
)
|
|
}
|