Admin: real sliding switch for enrollment, role=switch
This commit is contained in:
@@ -9,14 +9,16 @@
|
||||
}
|
||||
.count-chip b { font: 700 1.6rem/1 var(--round); color: var(--ink); letter-spacing: -.02em; }
|
||||
|
||||
/* the toggle reads as a switch: knob left when closed, right + green when open */
|
||||
.enroll-toggle { gap: 10px; padding-left: 12px; }
|
||||
.enroll-toggle::before {
|
||||
content: ""; flex: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line);
|
||||
box-shadow: inset 2px 0 0 2px var(--line), inset 16px 0 0 2px #fff; transition: box-shadow .2s, background .2s;
|
||||
}
|
||||
.enroll-toggle { gap: 10px; padding-left: 10px; }
|
||||
.enroll-toggle.on { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
|
||||
.enroll-toggle.on::before { background: var(--ok); box-shadow: inset 16px 0 0 2px var(--ok), inset 32px 0 0 2px #fff; }
|
||||
.switch { position: relative; flex: none; width: 36px; height: 22px; border-radius: 99px; background: var(--line); transition: background .2s; }
|
||||
.switch::after {
|
||||
content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
|
||||
background: #fff; box-shadow: 0 1px 2px rgba(28, 32, 54, .25); transition: transform .2s cubic-bezier(.3, .7, .4, 1);
|
||||
}
|
||||
.enroll-toggle.on .switch { background: var(--ok); }
|
||||
.enroll-toggle.on .switch::after { transform: translateX(14px); }
|
||||
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
|
||||
|
||||
#open-screen .icon { color: var(--ink-3); }
|
||||
#open-screen.connected .icon { color: var(--ok); }
|
||||
|
||||
+3
-2
@@ -48,9 +48,10 @@ function render() {
|
||||
|
||||
const tb = $("#toggle-enroll");
|
||||
// the switch itself carries the state, no status wording
|
||||
tb.textContent = "Inscriptions";
|
||||
tb.replaceChildren(h("span", { class: "switch", "aria-hidden": "true" }), "Inscriptions");
|
||||
tb.className = "enroll-toggle " + (p.enrollment_open ? "on" : "off");
|
||||
tb.setAttribute("aria-pressed", String(p.enrollment_open));
|
||||
tb.setAttribute("role", "switch");
|
||||
tb.setAttribute("aria-checked", String(p.enrollment_open));
|
||||
|
||||
$("#open-screen").classList.toggle("connected", state.screens > 0);
|
||||
$("#open-screen").title = state.screens ? "Projecteur connecté" : "Aucun projecteur connecté";
|
||||
|
||||
Reference in New Issue
Block a user