Skip to content

Commit

Permalink
[@mantine/core] Make header height of Modal and Drawer consistent to …
Browse files Browse the repository at this point in the history
…prevent layout shift when `withCloseButton` prop is changed
  • Loading branch information
rtivital committed Dec 8, 2023
1 parent 7868e47 commit 8264ea6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/@mantine/core/src/components/Modal/Modal.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ export function Usage() {
);
}

export function ConsistentHeaderHeight() {
const [opened, { open, close }] = useDisclosure(true);
const [withCloseButton, handlers] = useDisclosure(true);

return (
<div style={{ padding: 40 }}>
<Button onClick={open}>Open modal</Button>
{content}
<Button onClick={open}>Open modal</Button>
<Modal
opened={opened}
onClose={close}
title="Toggle close button"
withCloseButton={withCloseButton}
zIndex={73812}
>
<Button onClick={handlers.toggle}>Toggle close button</Button>
</Modal>
</div>
);
}

export function WithTabs() {
const [opened, { open, close }] = useDisclosure(true);
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
top: 0;
background-color: var(--mantine-color-body);
z-index: 1000;
min-height: rem(60px);

@mixin rtl {
--_pr: var(--mb-padding, var(--mantine-spacing-md));
Expand Down

0 comments on commit 8264ea6

Please sign in to comment.