36 lines
1.3 KiB
React
36 lines
1.3 KiB
React
import * as React from 'react';
|
|||
|
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
||
|
|
import { cn } from '../../lib/utils';
|
||
|
|
|
||
|
|
const DropdownMenu = DropdownMenuPrimitive.Root;
|
||
|
|
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
||
|
|
|
||
|
|
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 8, ...props }, ref) => (
|
||
|
|
<DropdownMenuPrimitive.Portal>
|
||
|
|
<DropdownMenuPrimitive.Content
|
||
|
|
ref={ref}
|
||
|
|
sideOffset={sideOffset}
|
||
|
|
className={cn(
|
||
|
|
'z-50 min-w-[8rem] overflow-hidden rounded-xl border border-app-border bg-white p-1 text-app-text shadow-app-panel',
|
||
|
|
className
|
||
|
|
)}
|
||
|
|
{...props}
|
||
|
|
/>
|
||
|
|
</DropdownMenuPrimitive.Portal>
|
||
|
|
));
|
||
|
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
||
|
|
|
||
|
|
const DropdownMenuItem = React.forwardRef(({ className, ...props }, ref) => (
|
||
|
|
<DropdownMenuPrimitive.Item
|
||
|
|
ref={ref}
|
||
|
|
className={cn(
|
||
|
|
'relative flex cursor-pointer select-none items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-none transition-colors focus:bg-app-interactive-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
||
|
|
className
|
||
|
|
)}
|
||
|
|
{...props}
|
||
|
|
/>
|
||
|
|
));
|
||
|
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
||
|
|
|
||
|
|
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem };
|