Skip to content

Commit

Permalink
[#2253] Improved modals after PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jiromaykin committed Mar 26, 2024
1 parent c3d94fe commit 353d68d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/open_inwoner/js/components/modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,39 @@ export default class Modal {
// Whether the modal-buttons should have icons or not
if (modalIcons) {
this.node.classList.add('show-modal-icons')
} else {
// Remove lingering elements if user did not close other modals
this.node.classList.remove('show-modal-icons')
}
}

setConfirmButtonVisibility(confirmVisibility) {
// Accessibility: whether the modal should have a confirm button or not
if (confirmVisibility) {
this.node.classList.add('show-confirm-button')
} else {
// Remove lingering elements if user did not close other modals
this.node.classList.remove('show-confirm-button')
}
}

setCancelButtonVisibility(cancelVisibility) {
// Accessibility: whether the modal should have a cancel button or not
if (cancelVisibility) {
this.node.classList.add('show-cancel-button')
} else {
// Remove lingering elements if user did not close other modals
this.node.classList.remove('show-cancel-button')
}
}

setButtonIconCloseVisibility(buttonIconCloseVisibility) {
// Whether the modal should have a top-right close button or not
if (buttonIconCloseVisibility) {
this.node.classList.add('show-button-icon-close')
} else {
// Remove lingering elements if user did not close other modals
this.node.classList.remove('show-button-icon-close')
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/open_inwoner/scss/components/modal/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
@media (min-width: 768px) {
min-width: 150px;
}

&:focus {
transform: none;
}

&:hover:focus {
transform: translateY(-1px);
}
}

&__actions {
Expand Down Expand Up @@ -111,6 +119,10 @@
margin: calc(-1 * var(--spacing-extra-large))
calc(-1 * var(--spacing-extra-large)) 0 0;
}

&:hover {
transform: none;
}
}
}

Expand Down

0 comments on commit 353d68d

Please sign in to comment.