File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 22
33import { cn } from "@/lib/utils" ;
44import * as DropdownMenu from "@radix-ui/react-dropdown-menu" ;
5- import React , { HTMLAttributes } from "react" ;
5+ import React , { ComponentPropsWithoutRef , HTMLAttributes } from "react" ;
66
77const Menu = DropdownMenu . Root ;
88const Trigger = DropdownMenu . Trigger ;
99
10- interface IMenuContent extends HTMLAttributes < HTMLDivElement > {
11- children : React . ReactNode ;
12- }
10+ interface IMenuContent
11+ extends ComponentPropsWithoutRef < typeof DropdownMenu . Content > { }
1312
1413const Content = ( { className, ...props } : IMenuContent ) => (
1514 < DropdownMenu . Portal >
@@ -25,12 +24,20 @@ const Content = ({ className, ...props }: IMenuContent) => (
2524 </ DropdownMenu . Portal >
2625) ;
2726
28- const MenuItem = ( props : any ) => (
27+ const MenuItem = React . forwardRef <
28+ HTMLDivElement ,
29+ ComponentPropsWithoutRef < typeof DropdownMenu . Item >
30+ > ( ( { className, ...props } , ref ) => (
2931 < DropdownMenu . Item
30- className = "p-2 hover:bg-primary-400 outline-none cursor-pointer "
32+ ref = { ref }
33+ className = { cn (
34+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-primary-400 hover:text-white focus:bg-primary-400 focus:text-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50" ,
35+ className
36+ ) }
3137 { ...props }
3238 />
33- ) ;
39+ ) ) ;
40+ MenuItem . displayName = "MenuItem" ;
3441
3542const MenuComponent = Object . assign ( Menu , {
3643 Trigger,
You can’t perform that action at this time.
0 commit comments