Skip to content

Commit 6612baf

Browse files
committed
support paddingSize property
1 parent 7646e53 commit 6612baf

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src/components/DecoupledOverlay/DecoupledOverlay.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { createPortal } from "react-dom";
33
import { Classes as BlueprintClasses } from "@blueprintjs/core";
44
import { createPopper } from "@popperjs/core";
55

6-
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
7-
import { ContextOverlayProps, TestableComponent, TooltipSize } from "../../index";
6+
import { CLASSPREFIX as eccgui, ContextOverlayProps, TestableComponent, TooltipSize, WhiteSpaceContainer } from "../../index";
87

98
export interface DecoupledOverlayProps
109
extends React.HTMLAttributes<HTMLDivElement>,
1110
TestableComponent,
12-
Pick<ContextOverlayProps, "usePortal" | "portalContainer" | "placement" | "minimal"> {
11+
Pick<ContextOverlayProps, "usePortal" | "portalContainer" | "placement" | "minimal" | "paddingSize"> {
1312
/**
1413
* Element that should be used. The step content is displayed as a tooltip instead of a modal.
1514
* In case of an array, the first match is highlighted. */
@@ -33,6 +32,7 @@ export const DecoupledOverlay = ({
3332
minimal = false,
3433
placement = "auto",
3534
size = "large",
35+
paddingSize,
3636
children,
3737
}: DecoupledOverlayProps) => {
3838
const overlayRef = React.useCallback(
@@ -76,7 +76,18 @@ export const DecoupledOverlay = ({
7676
aria-hidden
7777
/>
7878
)}
79-
<div className={`${BlueprintClasses.POPOVER_CONTENT} ${eccgui}-decoupled-overlay__content`}>{children}</div>
79+
<div className={`${BlueprintClasses.POPOVER_CONTENT} ${eccgui}-decoupled-overlay__content`}>
80+
{paddingSize ? (
81+
<WhiteSpaceContainer
82+
paddingTop={paddingSize}
83+
paddingRight={paddingSize}
84+
paddingBottom={paddingSize}
85+
paddingLeft={paddingSize}
86+
>
87+
{children}
88+
</WhiteSpaceContainer>
89+
) : children}
90+
</div>
8091
</div>
8192
);
8293

0 commit comments

Comments
 (0)