Skip to content

Commit

Permalink
feat: add zIndex property
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurFerrao committed Oct 30, 2024
1 parent aeafb8f commit 0977e25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion react/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ interface Props {
customPixelEventId?: PixelData['id']
customPixelEventName?: PixelData['event']
onVisibilityChanged?: (visible: boolean) => void
zIndex?: number
}

function menuReducer(state: MenuState, action: MenuAction) {
Expand Down Expand Up @@ -128,6 +129,7 @@ function Drawer(props: Props) {
customPixelEventId,
customPixelEventName,
onVisibilityChanged,
zIndex = 999,
} = props
const handles = useCssHandles(CSS_HANDLES)
const backdropMode = useResponsiveValue(backdropModeProp)
Expand Down Expand Up @@ -203,7 +205,7 @@ function Drawer(props: Props) {
)}
</div>
<Portal>
<Overlay visible={overlayVisible} onClick={closeMenu} />
<Overlay visible={overlayVisible} onClick={closeMenu} zIndex={zIndex} />
<Suspense fallback={<React.Fragment />}>
<Swipable
{...{
Expand All @@ -225,6 +227,7 @@ function Drawer(props: Props) {
maxWidth,
minWidth: 280,
pointerEvents: isMenuOpen ? 'auto' : 'none',
zIndex

Check failure on line 230 in react/Drawer.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `,`
}}
>
<div
Expand Down
4 changes: 3 additions & 1 deletion react/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { useCssHandles, applyModifiers } from 'vtex.css-handles'
interface Props {
visible: boolean
onClick(event: React.MouseEvent | React.TouchEvent): void
zIndex?: number
}

const CSS_HANDLES = ['overlay'] as const

const Overlay: RefForwardingComponent<HTMLDivElement, Props> = (
{ visible, onClick }: Props,
{ visible, onClick, zIndex = 999 }: Props,
ref
) => {
const handles = useCssHandles(CSS_HANDLES)
Expand All @@ -23,6 +24,7 @@ const Overlay: RefForwardingComponent<HTMLDivElement, Props> = (
style={{
opacity: visible ? 0.5 : 0,
pointerEvents: visible ? 'auto' : 'none',
zIndex

Check failure on line 27 in react/Overlay.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `,`
}}
className={`${applyModifiers(
handles.overlay,
Expand Down

0 comments on commit 0977e25

Please sign in to comment.