Add display of votes on top of each prompt's vote button
authorCarl Worth <cworth@cworth.org>
Mon, 8 Jun 2020 16:15:00 +0000 (09:15 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 8 Jun 2020 16:15:00 +0000 (09:15 -0700)
This is a simple bit of feedback so players can see which options are
being voted on by other players. I won't claim that there's anything
inspired about the stlying or color selection here. Maybe Karen will
have some suggestions to improve this later.

empathy/empathy.css
empathy/empathy.jsx

index f3a4c4b4cd0c60dc43222cbea0edbbabef96f182..d553597c6a4b2ca2b3f20b03d140668e5dee1bf6 100644 (file)
@@ -8,3 +8,24 @@
     padding: 1em;
     margin-top: 0.25em;
 }
+
+.vote-choices {
+    display: flex;
+}
+
+.vote-choice {
+    font-size: 40%;
+    background-color: var(--accent-color-bright);
+    color: var(--text-fg-on-accent-bright);
+    border-radius: 4px;
+    padding-left: 4px;
+    padding-right: 4px;
+    margin-right: 0.5em;
+}
+
+@media (hover:hover) {
+    button:hover .vote-choice {
+        background-color: var(--accent-color);
+        color: var(--text-fg-on-accent);
+    }
+}
index 1867381f15d4472ecff3775382b9d0b38ae50c01..b69ce6f15c3d090e178b27e78e89686a2e7051a1 100644 (file)
@@ -234,6 +234,18 @@ function PromptOptions(props) {
             onClick={() => handle_click(p.id)}
           >
             {p.prompt}
+            <div className="vote-choices">
+              {p.votes.map(v => {
+                return (
+                  <div
+                    key={v}
+                    className="vote-choice"
+                  >
+                    {v}
+                  </div>
+                );
+              })}
+            </div>
           </button>
         );
       })}