Skip to content

Commit

Permalink
💄(react) make Modal close button sticky
Browse files Browse the repository at this point in the history
We want to make sure this button is always visible inside scrollable
modals.

Fixes #278
  • Loading branch information
NathanVss committed Feb 28, 2024
1 parent c5e5d9f commit 680365a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-timers-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openfun/cunningham-react": minor
---

make Modal close button sticky
16 changes: 13 additions & 3 deletions packages/react/src/components/Modal/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@
}

&__close {
position: absolute;
top: 0.75rem;
right: 0.75rem;
position: sticky;
top: 0;
display: flex;
justify-content: end;
z-index: 1;
height: 0;

.c__button {
right: -0.75rem;
top: -0.75rem;
position: relative;
background: var(--c--components--modal--background-color);
}
}

&__footer {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export const ModalInner = (props: ModalProps) => {
<Button
icon={<span className="material-icons">close</span>}
color="tertiary-text"
size="nano"
size="small"
onClick={() => props.onClose()}
/>
</div>
Expand Down

0 comments on commit 680365a

Please sign in to comment.