Aout d'une image sur le modal

Fix #257
This commit is contained in:
Jean-Marie Favreau 2024-12-22 12:15:29 +01:00
parent 430c7b47a2
commit 4a174d30ef
4 changed files with 38 additions and 8 deletions

View File

@ -34,11 +34,17 @@ const openModal = (modal, back=true) => {
} }
setTimeout(function() { setTimeout(function() {
visibleModal = modal; visibleModal = modal;
}, 500);
console.log("ici");
const mask = visibleModal.querySelector(".h-mask");
mask.classList.add("visible");
}, 250);
}; };
const hideModal = (modal) => { const hideModal = (modal) => {
if (modal != null) { if (modal != null) {
const mask = visibleModal.querySelector(".h-mask");
mask.classList.remove("visible");
visibleModal = null; visibleModal = null;
document.documentElement.style.removeProperty("--scrollbar-width"); document.documentElement.style.removeProperty("--scrollbar-width");
modal.removeAttribute("open"); modal.removeAttribute("open");

View File

@ -44,6 +44,9 @@ $enable-responsive-typography: true;
// Modal (<dialog>) // Modal (<dialog>)
--modal-overlay-backdrop-filter: blur(0.05rem); --modal-overlay-backdrop-filter: blur(0.05rem);
--background-color-transparent: color-mix(in srgb, var(--background-color), transparent 30%);
--background-color-transparent-light: color-mix(in srgb, var(--background-color), transparent 80%);
} }
@ -1705,3 +1708,24 @@ label.required::after {
} }
} }
} }
.h-image {
background-repeat: no-repeat;
background-size: cover;
background-position: center, center;
}
dialog {
.h-mask {
background-color: var(--background-color);
margin: calc(var(--spacing) * -1.5);
padding: calc(var(--spacing) * 1.5);
}
.h-mask.visible {
background-color: var(--background-color-transparent);
transition: background-color .8s linear;
}
.h-mask.visible:hover {
background-color: var(--background-color-transparent-light);
}
}

View File

@ -96,7 +96,12 @@
{{ event|tw_badge }} {{ event|tw_badge }}
<dialog id="event-{{ event.id }}"> <dialog id="event-{{ event.id }}">
<article> <article>
<header> {% if event.has_image_url %}
<header style="background: url({{ event.get_image_url }});" class="h-image">
{% else %}
<header class="cat-{{ event.category.pk }}">
{% endif %}
<div class="h-mask">
<a href="#event-{{ event.id }}" <a href="#event-{{ event.id }}"
aria-label="Fermer" aria-label="Fermer"
class="close" class="close"
@ -128,6 +133,7 @@
{% endif %} {% endif %}
{% if event.end_time %} {% if not event.end_day|date|frdate or event.end_day == event.start_day %}jusqu'à{% endif %} {{ event.end_time }}{% endif %} {% if event.end_time %} {% if not event.end_day|date|frdate or event.end_day == event.start_day %}jusqu'à{% endif %} {{ event.end_time }}{% endif %}
</p> </p>
</div>
</header> </header>
<div class="body-fixed">{{ event.description |linebreaks }}</div> <div class="body-fixed">{{ event.description |linebreaks }}</div>

View File

@ -86,12 +86,6 @@ def css_categories():
) )
result += "}" result += "}"
result += "*:hover>." + c["css_class"] + " {"
result += background_color_adjust_color(
adjust_lightness_saturation(c["color"], 0.02, 1.0)
)
result += "}"
result += "." + c["css_class"] + ".circ-cat, " result += "." + c["css_class"] + ".circ-cat, "
result += "form ." + c["css_class"] + ", " result += "form ." + c["css_class"] + ", "
result += ".selected ." + c["css_class"] + " {" result += ".selected ." + c["css_class"] + " {"