Skip to content

Commit

Permalink
Support configuring z-index for modal (#230)
Browse files Browse the repository at this point in the history
* Support configuring z-index for modal

* bump version
  • Loading branch information
miafan23 authored Dec 4, 2024
1 parent d46aed4 commit 0ee57c7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapbox/mr-ui",
"version": "2.13.0",
"version": "2.14.0",
"description": "UI components for Mapbox projects",
"main": "index.js",
"homepage": "./",
Expand Down
9 changes: 8 additions & 1 deletion src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface Props {
size?: 'small' | 'large' | 'auto';
padding?: 'large' | 'none';
margin?: 'large' | 'default';
zIndex?: number;
onExit?: () => void;
exitOnUnderlayClicked?: boolean;
allowEventBubbling?: boolean;
Expand Down Expand Up @@ -53,6 +54,7 @@ export default function Modal({
size = 'large',
padding = 'large',
margin = 'default',
zIndex = 0,
allowEventBubbling = false,
exitOnUnderlayClicked = true,
initialFocus,
Expand Down Expand Up @@ -98,7 +100,8 @@ export default function Modal({
style: {
display: 'grid',
overflowY: 'auto',
placeItems: 'start center'
placeItems: 'start center',
zIndex
},
'data-testid': 'modal-overlay'
};
Expand Down Expand Up @@ -216,6 +219,10 @@ Modal.propTypes = {
* `'large'` to compensate for a fixed top header or `'default'` to be closer to the top of the viewport.
*/
margin: PropTypes.oneOf(['large', 'default']),
/**
* z-index of the modal
*/
zIndex: PropTypes.number,
/**
* The modal's primary action. If this is provided, an encouraging
* button will be rendered at the bottom of the modal.
Expand Down

0 comments on commit 0ee57c7

Please sign in to comment.