feat(ui): add close button to modal dialogs
Add × button to modal overlays for better UX. Button is positioned in top-right corner with hover effects and proper styling.
This commit is contained in:
+28
-2
@@ -229,10 +229,33 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.modal-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 16px;
|
||||||
|
right: 16px;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 8px;
|
||||||
|
transition: all 0.15s;
|
||||||
|
}
|
||||||
|
.modal-close:hover {
|
||||||
|
background: var(--surface2);
|
||||||
|
color: var(--text);
|
||||||
}
|
}
|
||||||
.modal h2 {
|
.modal h2 {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
|
padding-right: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Form */
|
/* Form */
|
||||||
@@ -781,8 +804,11 @@
|
|||||||
|
|
||||||
function openModal(html) {
|
function openModal(html) {
|
||||||
document.getElementById("modal-container").innerHTML = `
|
document.getElementById("modal-container").innerHTML = `
|
||||||
<div class="modal-overlay" onclick="if(event.target === this) closeModal()">
|
<div class="modal-overlay">
|
||||||
<div class="modal">${html}</div>
|
<div class="modal">
|
||||||
|
<button class="modal-close" onclick="closeModal()">✕</button>
|
||||||
|
${html}
|
||||||
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
document.body.style.overflow = "hidden";
|
document.body.style.overflow = "hidden";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user