Skip to content

Commit 71d1e76

Browse files
Fix drawer
1 parent 7b73e9a commit 71d1e76

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@undp/design-system-react",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"main": "./dist/index.cjs",
55
"module": "./dist/index.js",
66
"browser": "./dist/index.umd.js",

src/components/ui/drawer.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ function DrawerOverlay({
3838
);
3939
}
4040

41-
function DrawerContent({
42-
className,
43-
children,
44-
...props
45-
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
46-
return (
47-
<DrawerPortal data-slot='drawer-portal'>
41+
type DrawerContentProps = React.ComponentProps<typeof DrawerPrimitive.Content> & {
42+
inPortal?: boolean;
43+
};
44+
45+
function DrawerContent({ className, children, inPortal = false, ...props }: DrawerContentProps) {
46+
const content = (
47+
<>
4848
<DrawerOverlay />
4949
<DrawerPrimitive.Content
5050
data-slot='drawer-content'
@@ -83,8 +83,12 @@ function DrawerContent({
8383
{children}
8484
</div>
8585
</DrawerPrimitive.Content>
86-
</DrawerPortal>
86+
</>
8787
);
88+
if (inPortal) {
89+
return <DrawerPortal data-slot='drawer-portal'>{content}</DrawerPortal>;
90+
}
91+
return content;
8892
}
8993

9094
function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {

0 commit comments

Comments
 (0)