diff --git a/apps/web/src/components/ui/context-menu.tsx b/apps/web/src/components/ui/context-menu.tsx index defa075..7aa938f 100644 --- a/apps/web/src/components/ui/context-menu.tsx +++ b/apps/web/src/components/ui/context-menu.tsx @@ -3,6 +3,7 @@ import * as React from "react"; import { ContextMenu as ContextMenuPrimitive } from "radix-ui"; import { Check, ChevronRight, Circle } from "lucide-react"; +import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "../../lib/utils"; @@ -18,23 +19,40 @@ const ContextMenuSub = ContextMenuPrimitive.Sub; const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup; +const contextMenuItemVariants = cva( + "relative flex cursor-pointer select-none items-center gap-2 px-2 py-1.5 text-sm outline-none transition-opacity data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0", + { + variants: { + variant: { + default: "focus:opacity-65 focus:text-accent-foreground", + destructive: "text-destructive focus:text-destructive/80", + }, + }, + defaultVariants: { + variant: "default", + }, + } +); + const ContextMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean; + variant?: VariantProps["variant"]; } ->(({ className, inset, children, ...props }, ref) => ( +>(({ className, inset, children, variant = "default", ...props }, ref) => ( {children} - + )); ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName; @@ -62,7 +80,8 @@ const ContextMenuContent = React.forwardRef< , React.ComponentPropsWithoutRef & { inset?: boolean; + variant?: VariantProps["variant"]; } ->(({ className, inset, ...props }, ref) => ( +>(({ className, inset, variant = "default", ...props }, ref) => ( , - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => ( + React.ComponentPropsWithoutRef & { + variant?: VariantProps["variant"]; + } +>(({ className, children, checked, variant = "default", ...props }, ref) => ( @@ -115,19 +134,18 @@ ContextMenuCheckboxItem.displayName = const ContextMenuRadioItem = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( + React.ComponentPropsWithoutRef & { + variant?: VariantProps["variant"]; + } +>(({ className, children, variant = "default", ...props }, ref) => ( - + {children} @@ -144,7 +162,7 @@ const ContextMenuLabel = React.forwardRef< (({ className, ...props }, ref) => ( )); @@ -171,10 +189,7 @@ const ContextMenuShortcut = ({ }: React.HTMLAttributes) => { return ( );