Skip to content

Commit 12464b9

Browse files
authored
fix:[Lightbox] Increase z-index (#411)
* [Lightbox] Increase z-index * lint
1 parent eaaef98 commit 12464b9

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

packages/core/src/components/Lightbox/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import Sheet from '../Sheet';
33
import LightboxImage, { LightboxImageProps } from './Image';
44
import Header from './Header';
5+
import { styleSheetLightboxSheet } from './styles';
56

67
export type LightboxProps = {
78
/** Images to show. */
@@ -140,7 +141,16 @@ export default class Lightbox extends React.PureComponent<LightboxProps, Lightbo
140141
);
141142

142143
return (
143-
<Sheet compact headerShadow noAnimation portal visible header={header} onClose={onClose}>
144+
<Sheet
145+
compact
146+
headerShadow
147+
noAnimation
148+
portal
149+
visible
150+
header={header}
151+
styleSheet={styleSheetLightboxSheet}
152+
onClose={onClose}
153+
>
144154
<LightboxImage
145155
aside={aside}
146156
alt={alt}

packages/core/src/components/Lightbox/styles.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { ComponentBlock } from 'aesthetic';
2+
import { Z_INDEX_LIGHTBOX } from '../../constants';
13
import { StyleSheet } from '../../hooks/useStyles';
4+
import { styleSheetSheet } from '../Sheet/styles';
25

36
export const styleSheetHeader: StyleSheet = ({ unit }) => ({
47
header: {
@@ -49,3 +52,12 @@ export const styleSheetImage: StyleSheet = ({ color, unit }) => ({
4952
padding: unit * 3,
5053
},
5154
});
55+
56+
export const styleSheetLightboxSheet: StyleSheet = (theme) => {
57+
const sheetStyle = styleSheetSheet(theme);
58+
59+
// Override zIndex
60+
(sheetStyle.sheet as ComponentBlock).zIndex = Z_INDEX_LIGHTBOX;
61+
62+
return sheetStyle;
63+
};

packages/core/src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const STATUSES = ['notice', 'info', 'success', 'warning', 'danger', 'mute
102102
export const BRANDS = ['luxury', 'plus'];
103103
export const Z_INDEX_MODAL = 2000;
104104
export const Z_INDEX_PORTAL = 2000; // Same as Modal to fix Tooltip in Modal
105+
export const Z_INDEX_LIGHTBOX = 2004; // Lightbox is full screen and appears on top of everything else
105106
export const Z_INDEX_TOAST = 3000;
106107

107108
// EMOJIS

0 commit comments

Comments
 (0)