Browse code

Add simple view for suggestions at the prompt

Joseph Weston authored on 12/12/2021 21:40:41
Showing 1 changed files
... ...
@@ -10,6 +10,7 @@
10 10
 
11 11
 (defn prompt []
12 12
   (let [cmdline (re-frame/subscribe [::subs/cmdline])
13
+        suggestions (re-frame/subscribe [::subs/cmdline-suggestions])
13 14
         update-cmdline #(re-frame/dispatch-sync
14 15
                          [::events/update-cmdline (-> % .-target .-value)])
15 16
         key-pressed #(re-frame/dispatch-sync [::events/prompt-keypress %])
... ...
@@ -20,7 +21,11 @@
20 21
      [:input {:value @cmdline
21 22
               :on-change update-cmdline
22 23
               :on-keyDown key-pressed
23
-              :type "text"}]]))
24
+              :type "text"}]
25
+
26
+     [:ul.suggestions
27
+      (when @suggestions
28
+       (for [x @suggestions] ^{:key x} [:li x]))]]))
24 29
 
25 30
 (defn title []
26 31
   (let [name (re-frame/subscribe [::subs/name])]