Skip to content

Commit

Permalink
feat: allow consumers to configure ModalDialog to allow overflow (#2939)
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-smith-tcril committed Feb 12, 2024
1 parent 163ce82 commit 2801667
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Modal/ModalDialog.jsx
Expand Up @@ -30,6 +30,7 @@ function ModalDialog({
isFullscreenOnMobile,
isBlocking,
zIndex,
isOverflowVisible,
}) {
const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });
const showFullScreen = (isFullscreenOnMobile && isMobile);
Expand All @@ -44,6 +45,7 @@ function ModalDialog({
[`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,
[`pgn__modal-${variant}`]: variant,
'pgn__modal-scroll-fullscreen': isFullscreenScroll,
'pgn__modal-visible-overflow': isOverflowVisible,
},
className,
)}
Expand Down Expand Up @@ -120,6 +122,8 @@ ModalDialog.propTypes = {
* Specifies the z-index of the modal
*/
zIndex: PropTypes.number,
/** Specifies whether overflow is visible in the modal */
isOverflowVisible: PropTypes.bool,
};

ModalDialog.defaultProps = {
Expand All @@ -133,6 +137,7 @@ ModalDialog.defaultProps = {
isFullscreenOnMobile: false,
isBlocking: false,
zIndex: undefined,
isOverflowVisible: true,
};

ModalDialog.Header = ModalDialogHeader;
Expand Down
10 changes: 10 additions & 0 deletions src/Modal/_ModalDialog.scss
Expand Up @@ -38,6 +38,14 @@
top: calc(#{$modal-inner-padding} / 2 * -1);
}
}

&.pgn__modal-visible-overflow {
overflow: visible;

.pgn__modal-body {
overflow: visible;
}
}
}

// Sizes
Expand Down Expand Up @@ -94,6 +102,8 @@
justify-content: center;
position: sticky;
top: 0;
border-top-left-radius: $modal-content-border-radius;
border-top-right-radius: $modal-content-border-radius;
padding: $modal-header-padding;
background-color: $modal-content-bg;
transition: box-shadow 150ms ease;
Expand Down

0 comments on commit 2801667

Please sign in to comment.