Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tblivet committed Nov 26, 2024
1 parent a8203a3 commit 6e71acc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
16 changes: 8 additions & 8 deletions _dev/src/scss/components/_dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ $e: ".dialog";

@at-root {
::backdrop {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgb(0 0 0 / 0.5);
}
}

#{$ua-id} {
#{$e} {
width: 508px;
max-width: calc(100% - 2rem);
padding: 0;
border: none;
border-radius: var(--#{$ua-prefix}border-radius);
box-shadow: var(--#{$ua-prefix}box-shadow-dialog);
width: 508px;
max-width: calc(100% - 2rem);

&__content {
display: flex;
Expand All @@ -34,8 +34,8 @@ $e: ".dialog";

.close {
display: flex;
align-items: center;
flex-shrink: 0;
align-items: center;
float: none;
padding: 0.75rem;
margin: 0;
Expand Down Expand Up @@ -65,13 +65,13 @@ $e: ".dialog";
}

&__footer {
padding: 1.5rem;
padding-block-start: 0;
border: none;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 1rem;
justify-content: flex-end;
padding: 1.5rem;
padding-block-start: 0;
border: none;
}

// Custom dialogs
Expand Down
10 changes: 8 additions & 2 deletions _dev/src/ts/components/DialogContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default class DialogContainer implements DomLifecycle {
}

#displayDialog(): void {
const dialog = document.getElementById(DialogContainer.containerId)?.getElementsByClassName('dialog')[0] as HTMLDialogElement;
const dialog = document
.getElementById(DialogContainer.containerId)
?.getElementsByClassName('dialog')[0] as HTMLDialogElement;
if (dialog) {
dialog.showModal();
}
Expand All @@ -42,7 +44,11 @@ export default class DialogContainer implements DomLifecycle {
const dialog = target?.closest('.dialog');

if (dialog) {
if (target?.closest("[data-dismiss='dialog']") || !dialog.contains(target) || target === dialog) {
if (
target?.closest("[data-dismiss='dialog']") ||
!dialog.contains(target) ||
target === dialog
) {
dialog.dispatchEvent(new Event(DialogContainer.cancelEvent, { bubbles: true }));
} else if (target?.closest(".dialog__footer button:not([data-dismiss='dialog'])")) {
dialog.dispatchEvent(new Event(DialogContainer.okEvent, { bubbles: true }));
Expand Down

0 comments on commit 6e71acc

Please sign in to comment.