Skip to content

Commit 130ac70

Browse files
authored
Merge pull request #62 from oasisprotocol/csillag/fix-forwardref-warning-on-drawer
Add missing forwardRef wrapper for Drawer overlay
2 parents 35b9873 + fc37200 commit 130ac70

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

src/components/ui/drawer.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ function DrawerClose({ ...props }: React.ComponentProps<typeof DrawerPrimitive.C
1919
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
2020
}
2121

22-
function DrawerOverlay({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
23-
return (
24-
<DrawerPrimitive.Overlay
25-
data-slot="drawer-overlay"
26-
className={cn(
27-
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
28-
className
29-
)}
30-
{...props}
31-
/>
32-
)
33-
}
22+
const DrawerOverlay = React.forwardRef<HTMLDivElement, React.ComponentProps<typeof DrawerPrimitive.Overlay>>(
23+
({ className, ...props }, ref) => {
24+
return (
25+
<DrawerPrimitive.Overlay
26+
ref={ref}
27+
data-slot="drawer-overlay"
28+
className={cn(
29+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
30+
className
31+
)}
32+
{...props}
33+
/>
34+
)
35+
}
36+
)
3437

3538
function DrawerContent({
3639
className,

0 commit comments

Comments
 (0)