From 69a464a7671dc1d84abfcf74a0758dfc536f5827 Mon Sep 17 00:00:00 2001 From: efim Date: Sat, 1 Jul 2023 13:40:48 +0000 Subject: [PATCH] feat(14): controls generated from fragment with their own ids and htmx requests to submit the vote --- .../src/main/resources/public/output.css | 4 ++ .../src/main/resources/templates/index.html | 56 +++++++++++++------ .../main/scala/rockpaperscissors/Main.scala | 6 +- .../main/scala/rockpaperscissors/Models.scala | 49 +++++++++------- 4 files changed, 73 insertions(+), 42 deletions(-) diff --git a/14-rock-paper-scissors/src/main/resources/public/output.css b/14-rock-paper-scissors/src/main/resources/public/output.css index 1a7807d..6b08228 100644 --- a/14-rock-paper-scissors/src/main/resources/public/output.css +++ b/14-rock-paper-scissors/src/main/resources/public/output.css @@ -522,6 +522,10 @@ video { --tw-backdrop-sepia: ; } +.static { + position: static; +} + .fixed { position: fixed; } diff --git a/14-rock-paper-scissors/src/main/resources/templates/index.html b/14-rock-paper-scissors/src/main/resources/templates/index.html index b93a3d0..f00069c 100644 --- a/14-rock-paper-scissors/src/main/resources/templates/index.html +++ b/14-rock-paper-scissors/src/main/resources/templates/index.html @@ -59,34 +59,52 @@
+
+
- + th:fragment="choiceBadge (choiceBadgeData)" + id="paper" + th:id="${choiceBadgeData.c.name}" + class="top-[var(--top-offset)] left-[var(--left-offset)] w-[var(--diameter)] h-[var(--diameter)] bg-gradient-to-b rounded-full -translate-x-[var(--translation)] -translate-y-[var(--translation)] from-[var(--bg-bright)] to-[var(--bg-dark)]" + style=" + --diameter: 8rem; + --bg-dark: hsl(230, 89%, 62%); + --bg-bright: hsl(230, 89%, 65%); + --top-offset: 6rem; + --left-offset: 6rem; + --translation: 50%; + position: absolute; + " + th:style="| --diameter: ${choiceBadgeData.c.diameter}; + --bg-dark: ${choiceBadgeData.c.bgDark}; + --bg-bright: ${choiceBadgeData.c.bgBright}; + ${choiceBadgeData.p.toStyle}; |" + > +
+ +
+