mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Move colour mode and Discord controls into the mobile menu
This commit is contained in:
@@ -126,6 +126,11 @@ defmodule ChesstrainerWeb.Layouts do
|
||||
Start training <.icon_arrow />
|
||||
</.pill_button>
|
||||
<% end %>
|
||||
|
||||
<div class="nav-menu-tools">
|
||||
<.colour_mode_toggle />
|
||||
<.discord_link />
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -65,7 +65,10 @@
|
||||
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
||||
|
||||
event.preventDefault();
|
||||
const buttons = Array.from(document.querySelectorAll("[data-phx-theme]"));
|
||||
// Each breakpoint renders its own copy of the switch, so only the visible
|
||||
// group takes part in arrow-key navigation.
|
||||
const buttons = Array.from(document.querySelectorAll("[data-phx-theme]"))
|
||||
.filter((button) => button.offsetParent !== null);
|
||||
const offset = event.key === "ArrowRight" ? 1 : -1;
|
||||
const index = (buttons.indexOf(button) + offset + buttons.length) % buttons.length;
|
||||
const next = buttons[index];
|
||||
|
||||
Reference in New Issue
Block a user