Skip to content

Commit

Permalink
Rename property
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarenerd committed Feb 20, 2025
1 parent f5e9077 commit c7bfef7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ export interface PositronModalPopupProps {
readonly height: number | 'min-content';
readonly minHeight?: number | 'auto';
readonly maxHeight?: number | 'none';
readonly fixedHeight?: boolean;
readonly focusableElementSelectors?: string;
readonly keyboardNavigationStyle: KeyboardNavigationStyle;
readonly onAccept?: () => void;

yaba?: boolean;
}

/**
Expand Down Expand Up @@ -121,9 +120,6 @@ export const PositronModalPopup = (props: PropsWithChildren<PositronModalPopupPr
const { clientWidth: documentWidth, clientHeight: documentHeight } =
DOM.getWindow(popupRef.current).document.documentElement;

// Create the popup layout.
const popupLayout = new PopupLayout();

// Calculate the anchor position and size.
let anchorX: number;
let anchorY: number;
Expand All @@ -146,6 +142,9 @@ export const PositronModalPopup = (props: PropsWithChildren<PositronModalPopupPr
const leftAreaWidth = anchorX + anchorWidth - LAYOUT_MARGIN;
const rightAreaWidth = documentWidth - anchorX - LAYOUT_MARGIN;

// Create the popup layout.
const popupLayout = new PopupLayout();

/**
* Positions the popup aligned with the left edge of the anchor element.
*/
Expand Down Expand Up @@ -193,7 +192,7 @@ export const PositronModalPopup = (props: PropsWithChildren<PositronModalPopupPr
// Position the popup at the bottom.
const positionBottom = () => {
popupLayout.top = anchorY + anchorHeight + LAYOUT_OFFSET;
if (props.yaba) {
if (props.fixedHeight) {
popupLayout.top = Math.min(popupLayout.top, documentHeight - layoutHeight - LAYOUT_MARGIN);
} else {
popupLayout.maxHeight = documentHeight - popupLayout.top - LAYOUT_MARGIN;
Expand Down Expand Up @@ -262,7 +261,7 @@ export const PositronModalPopup = (props: PropsWithChildren<PositronModalPopupPr

// Set the popup layout.
setPopupLayout(popupLayout);
}, [props.anchorElement, props.anchorPoint, props.height, props.popupAlignment, props.popupPosition, props.width, props.yaba]);
}, [props.anchorElement, props.anchorPoint, props.height, props.popupAlignment, props.popupPosition, props.width, props.fixedHeight]);

// Layout.
useLayoutEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,13 +753,13 @@ export const AddEditRowFilterModalPopup = (props: AddEditRowFilterModalPopupProp
return (
<PositronModalPopup
anchorElement={props.anchorElement}
fixedHeight={true}
height={'min-content'}
keyboardNavigationStyle='dialog'
popupAlignment='auto'
popupPosition='auto'
renderer={props.renderer}
width={275}
yaba={true}
onAccept={applyRowFilter}
>
<div className='add-edit-row-filter-modal-popup-body'>
Expand Down

0 comments on commit c7bfef7

Please sign in to comment.