Skip to content

Commit 8227bcb

Browse files
committed
add class and style support for dialog overlay
1 parent 9f1cb66 commit 8227bcb

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

packages/raystack/dialog/dialog.tsx

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,35 @@ export interface DialogContentProps
1818

1919
export const DialogContent = forwardRef<
2020
ElementRef<typeof DialogPrimitive.Content>,
21-
DialogContentProps & { close?: boolean }
22-
>(({ className, children, close, ...props }, forwardedRef) => {
23-
return (
24-
<DialogPrimitive.Portal>
25-
<Overlay />
26-
<DialogPrimitive.Content
27-
{...props}
28-
ref={forwardedRef}
29-
className={dialogContent({ className })}
30-
>
31-
{children}
32-
{close && (
33-
<CloseButton>
34-
<Cross1Icon />
35-
</CloseButton>
36-
)}
37-
</DialogPrimitive.Content>
38-
</DialogPrimitive.Portal>
39-
);
40-
});
21+
DialogContentProps & {
22+
close?: boolean;
23+
overlayStyle?: React.CSSProperties;
24+
overlayClassname?: string;
25+
}
26+
>(
27+
(
28+
{ className, children, close, overlayStyle, overlayClassname, ...props },
29+
forwardedRef
30+
) => {
31+
return (
32+
<DialogPrimitive.Portal>
33+
<Overlay className={overlayClassname} style={overlayStyle} />
34+
<DialogPrimitive.Content
35+
{...props}
36+
ref={forwardedRef}
37+
className={dialogContent({ className })}
38+
>
39+
{children}
40+
{close && (
41+
<CloseButton>
42+
<Cross1Icon />
43+
</CloseButton>
44+
)}
45+
</DialogPrimitive.Content>
46+
</DialogPrimitive.Portal>
47+
);
48+
}
49+
);
4150

4251
const overlay = cva(styles.overlay);
4352
export interface OverlayProps

0 commit comments

Comments
 (0)