Skip to content

Commit

Permalink
add z-index prop for a modal
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrysurdin committed Oct 10, 2023
1 parent 6d3f87e commit 299a6d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/components/modal/modal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ $WIDTH-SMALL: 320px;
$WIDTH-DEFAULT: 480px;
$WIDTH-LARGE: 720px;

$Z-INDEX-OVERLAY: 2;

// TODO: Discuss with UX team. There are no designs for the dark theme, so the theme-independent CSS properties are used

@mixin modalWidth($width) {
Expand All @@ -29,19 +27,16 @@ $Z-INDEX-OVERLAY: 2;

.overlay-default {
background-color: var(--rp-ui-kit-overlay);
z-index: $Z-INDEX-OVERLAY;
}

.overlay-light-cyan {
background-color: var(--rp-ui-kit-overlay-light-cyan);
z-index: $Z-INDEX-OVERLAY;
}

.scrolling-content {
position: fixed;
width: 100%;
height: 100%;
z-index: $Z-INDEX-OVERLAY;
}

.modal-window {
Expand Down
4 changes: 3 additions & 1 deletion src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface ModalProps {
children?: ReactNode;
footerNode?: ReactNode;
className?: string;
zIndex?: number;
size?: ModalSize;
overlay?: ModalOverlay;
allowCloseOutside?: boolean;
Expand All @@ -44,6 +45,7 @@ export const Modal: FC<ModalProps> = ({
size = 'default',
onClose = () => {},
overlay = 'default',
zIndex = 2,
allowCloseOutside = true,
scrollable = false,
}) => {
Expand Down Expand Up @@ -93,7 +95,7 @@ export const Modal: FC<ModalProps> = ({
return (
<AnimatePresence onExitComplete={onClose}>
{isShown && (
<div className={cx('modal', { [`overlay-${overlay}`]: overlay })}>
<div className={cx('modal', { [`overlay-${overlay}`]: overlay })} style={{ zIndex }}>
<motion.div
className={cx('modal-window', { [`size-${size}`]: size }, className)}
key="modal-window"
Expand Down

0 comments on commit 299a6d8

Please sign in to comment.