Skip to content

Commit cfa8b27

Browse files
author
medevod
committed
BREAKING CHANGE mg modal use opened class to toggle visibility like mg dropdown
1 parent 9ed69d5 commit cfa8b27

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/plugins/mgModal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function registerModals() {
66
function setupModal(el: Element) {
77
// Function to handle modal removal
88
function removeModalHandler() {
9-
modal?.classList.remove("mg-show");
9+
modal?.classList.remove("opened");
1010
}
1111

1212
// Select the modal and close button elements
@@ -16,7 +16,7 @@ export function registerModals() {
1616

1717
// Add event listener to the element to show modal on click
1818
el.addEventListener("click", function (_: Event) {
19-
modal?.classList.add("mg-show");
19+
modal?.classList.add("opened");
2020
});
2121

2222
// Add event listener to the close button to remove modal on click

src/scss/extensions/mg-modal.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
background: rgb(0 0 0 / 70%);
2222
transition: opacity 0.3s;
2323

24+
&.opened {
25+
opacity: 1;
26+
visibility: visible;
27+
}
28+
2429
&>.mg-modal--content {
2530
background-color: $color-initial;
2631
border-radius: $control-radius;
@@ -64,19 +69,19 @@
6469
margin-left: -1rem;
6570
}
6671

67-
&.mg-show.mg-right>.mg-modal--content {
72+
&.opened.mg-right>.mg-modal--content {
6873
transform: translateX(-100vw);
6974
}
7075

71-
&.mg-show.mg-left>.mg-modal--content {
76+
&.opened.mg-left>.mg-modal--content {
7277
transform: translateX(100vw);
7378
}
7479

75-
&.mg-show.mg-top>.mg-modal--content {
80+
&.opened.mg-top>.mg-modal--content {
7681
transform: translateY(100vh);
7782
}
7883

79-
&.mg-show.mg-bottom>.mg-modal--content {
84+
&.opened.mg-bottom>.mg-modal--content {
8085
transform: translateY(-100vh);
8186
}
8287
}

0 commit comments

Comments
 (0)