Skip to content

Commit 66c68ab

Browse files
committed
refactor: replace class with variable
1 parent c3a710f commit 66c68ab

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

apps/playground/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export class AppComponent {
7777
this.backDropClicked = false;
7878
this.cleanConfig = this.normalizeConfig(config);
7979

80-
if (this.cleanConfig.overflow) document.body.classList.add('overflow');
81-
else document.body.classList.remove('overflow');
80+
if (this.cleanConfig.overflow) document.body.style.setProperty('--dialog-overflow', 'visible');
81+
else document.body.style.setProperty('--dialog-overflow', 'hidden');
8282

8383
const ref = this.dialog.open(compOrTemplate as any, this.cleanConfig);
8484

libs/dialog/src/lib/dialog.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@
9999
}
100100
}
101101

102-
body.ngneat-dialog-hidden:not(.overflow) {
103-
overflow: hidden;
102+
body {
103+
overflow: var(--dialog-overflow, hidden);
104104
}

libs/dialog/src/lib/dialog.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ export class DialogComponent implements OnInit, OnDestroy {
115115
}
116116
}
117117

118+
if (this.config.overflow) {
119+
document.body.style.setProperty('--dialog-overflow', 'visible');
120+
}
121+
118122
this.host.id = this.config.id;
119123
}
120124

0 commit comments

Comments
 (0)