Skip to content

Commit

Permalink
fix: mobile modal button visible (#138)
Browse files Browse the repository at this point in the history
* fix: initial attempt

* fix: check dvh loading

* fix: max height default

* fix: functional dvh approach

* fix: fallback case

* fix: reinstate support checks

* fix: instate overlay dvh

* fix: spacing tweak
  • Loading branch information
ColinBuyck authored Dec 4, 2023
1 parent 8d2c3ff commit 64941dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
14 changes: 11 additions & 3 deletions src/overlays/Modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,21 @@
width: auto;
}

max-height: 100vh;
max-width: 100vw;
@media (min-width: $screen-md) {
max-height: calc(100vh - var(--bloom-s6));
max-width: calc(100vw - var(--bloom-s6));
}
@supports (max-height: 100dvh) {
--max-height: 100dvh;
}
@supports not (max-height: 100dvh) {
@media (max-width: $screen-sm) {
padding-bottom: var(--bloom-s20);
border: none;
box-shadow: none;
background-clip: content-box;
}
}
}

.modal__header {
Expand Down Expand Up @@ -147,4 +156,3 @@
--modal-margin-top: var(--bloom-s6);
}
}

24 changes: 0 additions & 24 deletions src/overlays/Modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,30 +254,6 @@ export const ScrollableModalMinimalContent = () => {
)
}

export const TransparentOverlayModal = () => (
<Modal
open={true}
title={text("Title", "Modal Title")}
ariaDescription={text("Aria Description", "Modal Description")}
hideCloseIcon={true}
actions={[
<Button
size={AppearanceSizeType.small}
onClick={noop}
styleType={AppearanceStyleType.primary}
>
{text("Action 2 Label", "Submit")}
</Button>,
<Button size={AppearanceSizeType.small} onClick={noop}>
{text("Action 1 Label", "Cancel")}
</Button>,
]}
backdrop={false}
>
{text("Content", "Modal Content")}
</Modal>
)

export const ManyButtons = () => {
const [openModal, setOpenModal] = useState(false)

Expand Down
3 changes: 3 additions & 0 deletions src/overlays/Overlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
--overlay-background-color: var(--bloom-color-gray-950);
--overlay-opacity: 0.5;
--overlay-height: 100vh;
@supports (height: 100dvh) {
--overlay-height: 100dvh;
}

position: fixed;
display: flex;
Expand Down

0 comments on commit 64941dd

Please sign in to comment.