Skip to content

Commit

Permalink
refactor: replace class with variable
Browse files Browse the repository at this point in the history
  • Loading branch information
vicky-polatov committed Apr 28, 2024
1 parent c3a710f commit 66c68ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/playground/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export class AppComponent {
this.backDropClicked = false;
this.cleanConfig = this.normalizeConfig(config);

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

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

Expand Down
4 changes: 2 additions & 2 deletions libs/dialog/src/lib/dialog.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@
}
}

body.ngneat-dialog-hidden:not(.overflow) {
overflow: hidden;
body {
overflow: var(--dialog-overflow, hidden);
}
4 changes: 4 additions & 0 deletions libs/dialog/src/lib/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export class DialogComponent implements OnInit, OnDestroy {
}
}

if (this.config.overflow) {
document.body.style.setProperty('--dialog-overflow', 'visible');
}

this.host.id = this.config.id;
}

Expand Down

0 comments on commit 66c68ab

Please sign in to comment.