From 796308e68e6f54045a3c610a5e1056cd63b0e3b2 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 29 Jun 2025 23:08:52 +0200 Subject: [PATCH] style: make everything consistent in dropdown --- apps/web/src/components/ui/dropdown-menu.tsx | 54 +++++++++++--------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/apps/web/src/components/ui/dropdown-menu.tsx b/apps/web/src/components/ui/dropdown-menu.tsx index 460bfc9..9db8a26 100644 --- a/apps/web/src/components/ui/dropdown-menu.tsx +++ b/apps/web/src/components/ui/dropdown-menu.tsx @@ -19,16 +19,33 @@ const DropdownMenuSub = DropdownMenuPrimitive.Sub; const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; +const dropdownMenuItemVariants = 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 DropdownMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean; + variant?: VariantProps["variant"]; } ->(({ className, inset, children, ...props }, ref) => ( +>(({ className, inset, children, variant = "default", ...props }, ref) => ( 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 DropdownMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { @@ -112,12 +114,15 @@ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; const DropdownMenuCheckboxItem = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => ( + React.ComponentPropsWithoutRef & { + variant?: VariantProps["variant"]; + } +>(({ className, children, checked, variant = "default", ...props }, ref) => ( , - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( + React.ComponentPropsWithoutRef & { + variant?: VariantProps["variant"]; + } +>(({ className, children, variant = "default", ...props }, ref) => (