diff --git a/lib/chesstrainer_web/live/endgame_live/train.ex b/lib/chesstrainer_web/live/endgame_live/train.ex index 963494c..2daf9bf 100644 --- a/lib/chesstrainer_web/live/endgame_live/train.ex +++ b/lib/chesstrainer_web/live/endgame_live/train.ex @@ -93,10 +93,22 @@ defmodule ChesstrainerWeb.EndgameLive.Train do <% else %>
-

Choose a difficulty

-

- Your rating: {round(@user_rating)} · bands of ±{Puzzles.band_width()} -

+
+
+

Choose a difficulty

+

+ Your rating: {round(@user_rating)} · bands of ±{Puzzles.band_width()} +

+
+ <.link + id="close-difficulty" + navigate={~p"/"} + aria-label="Close and return home" + class="rounded-md p-1 text-muted hover:bg-base-200 hover:text-base-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary" + > + <.icon name="hero-x-mark" class="size-5" /> + +
<%= for {difficulty, label, description} <- difficulty_options(@user_rating) do %> <.button @@ -111,6 +123,9 @@ defmodule ChesstrainerWeb.EndgameLive.Train do <% end %>
+ <.button navigate={~p"/"} variant="ghost" class="mt-2 w-full justify-center"> + Cancel +
<% end %> diff --git a/test/chesstrainer_web/live/endgame_live/train_test.exs b/test/chesstrainer_web/live/endgame_live/train_test.exs index ec20abc..d0ba561 100644 --- a/test/chesstrainer_web/live/endgame_live/train_test.exs +++ b/test/chesstrainer_web/live/endgame_live/train_test.exs @@ -85,6 +85,8 @@ defmodule ChesstrainerWeb.EndgameLive.TrainTest do assert has_element?(view, "#difficulty-easy") assert has_element?(view, "#difficulty-medium") assert has_element?(view, "#difficulty-hard") + assert has_element?(view, "#close-difficulty[href='/']") + assert has_element?(view, "a", "Cancel") assert render(view) =~ "Choose a difficulty" end