Skip to content

Commit 7646e53

Browse files
committed
provide option to add whitespace around overlay content
1 parent 239bafb commit 7646e53

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

src/components/ContextOverlay/ContextOverlay.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Utils as BlueprintUtils,
88
} from "@blueprintjs/core";
99

10-
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
10+
import { CLASSPREFIX as eccgui, WhiteSpaceContainer, WhiteSpaceContainerProps } from "../../index";
1111

1212
export interface ContextOverlayProps extends Omit<BlueprintPopoverProps, "position"> {
1313
/**
@@ -24,6 +24,11 @@ export interface ContextOverlayProps extends Omit<BlueprintPopoverProps, "positi
2424
* Currently experimental.
2525
*/
2626
usePlaceholder?: boolean;
27+
/**
28+
* Adds white space to each side of the overlay content.
29+
* For more control use `WhiteSpaceContainer` directly as wrapper for the content children.
30+
*/
31+
paddingSize?: WhiteSpaceContainerProps["paddingTop"];
2732
}
2833

2934
/**
@@ -36,6 +41,8 @@ export const ContextOverlay = ({
3641
preventTopPosition,
3742
className = "",
3843
usePlaceholder = false,
44+
paddingSize,
45+
content,
3946
...otherPopoverProps
4047
}: ContextOverlayProps) => {
4148
const placeholderRef = React.useRef<HTMLElement>(null);
@@ -169,6 +176,18 @@ export const ContextOverlay = ({
169176
) : (
170177
<BlueprintPopover
171178
placement="bottom"
179+
content={content ? (
180+
paddingSize ? (
181+
<WhiteSpaceContainer
182+
paddingTop={paddingSize}
183+
paddingRight={paddingSize}
184+
paddingBottom={paddingSize}
185+
paddingLeft={paddingSize}
186+
>
187+
{content}
188+
</WhiteSpaceContainer>
189+
) : content
190+
) : undefined}
172191
{...otherPopoverProps}
173192
className={targetClassName}
174193
portalClassName={portalClassNameFinal.trim() ?? undefined}

0 commit comments

Comments
 (0)