Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/core] Drawer: withOverlay={false} should let you click-through #2351

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 37 additions & 32 deletions src/mantine-core/src/Drawer/Drawer.styles.ts
Expand Up @@ -16,6 +16,7 @@ export interface DrawerStylesParams {
position: DrawerPosition;
size: number | string;
zIndex: React.CSSProperties['zIndex'];
withOverlay: boolean;
}

interface GetPositionStyles {
Expand Down Expand Up @@ -47,39 +48,43 @@ function getPositionStyles({
}
}

export default createStyles((theme, { position, size, zIndex }: DrawerStylesParams) => ({
closeButton: {},
overlay: {},
export default createStyles(
(theme, { position, size, zIndex, withOverlay }: DrawerStylesParams) => ({
closeButton: {},
overlay: {},

root: {
position: 'fixed',
zIndex,
top: 0,
left: 0,
right: 0,
bottom: 0,
},
root: {
position: 'fixed',
zIndex,
top: 0,
left: 0,
right: 0,
bottom: 0,
pointerEvents: withOverlay === false ? 'none' : undefined,
},

drawer: {
...getPositionStyles({ position, size, theme }),
maxWidth: '100%',
maxHeight: '100vh',
position: 'fixed',
outline: 0,
zIndex: 1,
},
drawer: {
...getPositionStyles({ position, size, theme }),
maxWidth: '100%',
maxHeight: '100vh',
position: 'fixed',
outline: 0,
zIndex: 1,
pointerEvents: withOverlay === false ? 'auto' : undefined,
},

title: {
marginRight: theme.spacing.md,
textOverflow: 'ellipsis',
display: 'block',
wordBreak: 'break-word',
},
title: {
marginRight: theme.spacing.md,
textOverflow: 'ellipsis',
display: 'block',
wordBreak: 'break-word',
},

header: {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: theme.spacing.md,
},
}));
header: {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: theme.spacing.md,
},
})
);
2 changes: 1 addition & 1 deletion src/mantine-core/src/Drawer/Drawer.tsx
Expand Up @@ -164,7 +164,7 @@ export function Drawer(props: DrawerProps) {
} = useComponentDefaultProps('Drawer', defaultProps, props);

const { classes, cx, theme } = useStyles(
{ size, position, zIndex },
{ size, position, zIndex, withOverlay },
{ classNames, styles, unstyled, name: 'Drawer' }
);

Expand Down