Skip to content

Commit

Permalink
fix: quick fix for shadowDom issue in dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
inga authored and Markus-Ende committed Aug 1, 2024
1 parent a3204f6 commit 5e4b8f0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
1 change: 0 additions & 1 deletion apps/demo-app/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}

html,
Expand Down
27 changes: 19 additions & 8 deletions libs/sketch/src/lib/components/dialog/dialog.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@
--sk-dialog-backdrop-blur: 0;
}

.display-flex {
display: flex;
}

.sk-dialog {
width: var(--sk-dialog-width);
height: var(--sk-dialog-height);
width: 100vw;
height: 100vh;
max-width: 100%;
max-height: 100%;
padding: 0;
border: none;
outline: none;
background-color: transparent;
position: relative;
align-items: center;
justify-content: center;
}

.sk-dialog:has(::backdrop) {
Expand Down Expand Up @@ -59,16 +66,13 @@
right: auto;
}

.sk-dialog-fullscreen-dialog {
height: 100%;
}

.sk-dialog-wrapper {
position: relative;
display: flex;
inset: auto;
margin: var(--sk-dialog-margin);
height: calc(100% - (var(--sk-dialog-margin) * 2));
max-height: calc(100svh - (var(--sk-dialog-margin) * 2));
width: var(--sk-dialog-width);
height: var(--sk-dialog-height);
}

.sk-dialog-content-container {
Expand Down Expand Up @@ -102,3 +106,10 @@
(var(--sk-dialog-container-padding) * 2)
);
}

.sk-dialog-fullscreen-dialog {
height: calc(100% - (var(--sk-dialog-margin) * 2));
max-height: calc(100svh - (var(--sk-dialog-margin) * 2));
width: calc(100% - (var(--sk-dialog-margin) * 2));
max-width: calc(100svw - (var(--sk-dialog-margin) * 2));
}
7 changes: 5 additions & 2 deletions libs/sketch/src/lib/components/dialog/dialog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
skClickBackdrop
(clickedBackdrop)="close.emit()"
(keydown.escape)="close.emit()"
[ngClass]="{ 'sk-dialog-fullscreen-dialog': fullscreen() }"
[class.display-flex]="open()"
>
<div class="sk-dialog-wrapper">
<div
class="sk-dialog-wrapper"
[ngClass]="{ 'sk-dialog-fullscreen-dialog': fullscreen() }"
>
@if (showCloseButton()) {
<div
class="sk-dialog-close-button"
Expand Down
2 changes: 0 additions & 2 deletions libs/sketch/src/lib/components/dialog/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
output,
viewChild,
model,
ViewEncapsulation,
untracked,
ElementRef,
} from '@angular/core';
Expand All @@ -23,7 +22,6 @@ export enum CloseButtonPosition {
imports: [ClickBackdropDirective, NgClass],
templateUrl: './dialog.component.html',
styleUrl: './dialog.component.css',
encapsulation: ViewEncapsulation.ShadowDom,
})
export class DialogComponent {
readonly open = model(false);
Expand Down

0 comments on commit 5e4b8f0

Please sign in to comment.