g1t/apps/web/app/components/ui/dropdown-menu.tsx
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed) | 1 | import { DropdownMenu as Primitive } from "radix-ui"; |
| 2 | import type { ComponentProps } from "react"; | |
| 3 | ||
| 4 | import { cn } from "../../lib/cn"; | |
| 5 | ||
| 6 | // shadcn/ui's dropdown menu, styled with g1t's tokens. | |
| 7 | ||
| 8 | export const DropdownMenu = Primitive.Root; | |
| 9 | export const DropdownMenuTrigger = Primitive.Trigger; | |
| 10 | export const DropdownMenuGroup = Primitive.Group; | |
| 11 | ||
| 12 | export function DropdownMenuContent({ | |
| 13 | className, | |
| 14 | sideOffset = 6, | |
| 15 | ...props | |
| 16 | }: ComponentProps<typeof Primitive.Content>) { | |
| 17 | return ( | |
| 18 | <Primitive.Portal> | |
| 19 | <Primitive.Content | |
| 20 | sideOffset={sideOffset} | |
| 21 | className={cn( | |
| 22 | "z-50 min-w-48 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg border border-line-strong bg-raised p-1 text-sm shadow-xl shadow-black/40", | |
| Workspace names and icons, and a component kit for every control | 23 | "data-[state=open]:animate-pop-in data-[state=closed]:animate-pop-out motion-reduce:animate-none", |
| Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed) | 24 | className, |
| 25 | )} | |
| 26 | {...props} | |
| 27 | /> | |
| 28 | </Primitive.Portal> | |
| 29 | ); | |
| 30 | } | |
| 31 | ||
| 32 | export function DropdownMenuItem({ | |
| 33 | className, | |
| 34 | ...props | |
| 35 | }: ComponentProps<typeof Primitive.Item>) { | |
| 36 | return ( | |
| 37 | <Primitive.Item | |
| 38 | className={cn( | |
| 39 | "flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-fg/90 outline-none select-none", | |
| 40 | "data-highlighted:bg-line data-highlighted:text-fg data-disabled:opacity-50", | |
| 41 | "[&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-faint", | |
| 42 | className, | |
| 43 | )} | |
| 44 | {...props} | |
| 45 | /> | |
| 46 | ); | |
| 47 | } | |
| 48 | ||
| 49 | export function DropdownMenuLabel({ | |
| 50 | className, | |
| 51 | ...props | |
| 52 | }: ComponentProps<typeof Primitive.Label>) { | |
| 53 | return ( | |
| 54 | <Primitive.Label | |
| 55 | className={cn("px-2 py-1.5 text-xs text-faint", className)} | |
| 56 | {...props} | |
| 57 | /> | |
| 58 | ); | |
| 59 | } | |
| 60 | ||
| 61 | export function DropdownMenuSeparator({ | |
| 62 | className, | |
| 63 | ...props | |
| 64 | }: ComponentProps<typeof Primitive.Separator>) { | |
| 65 | return ( | |
| 66 | <Primitive.Separator | |
| 67 | className={cn("-mx-1 my-1 h-px bg-line", className)} | |
| 68 | {...props} | |
| 69 | /> | |
| 70 | ); | |
| 71 | } |