Skip to content

Commit 133bf7d

Browse files
author
awb99
committed
label added (for grouping)
1 parent 57567ba commit 133bf7d

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

demo/deps.edn

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"target/webly"]
44

55
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
6-
org.pinkgorilla/webly {:mvn/version "0.7.702"} ; build tool
6+
org.pinkgorilla/webly {:mvn/version "0.7.703"} ; build tool
77
; goldly extensions:
88
org.pinkgorilla/ui-tailwind {:mvn/version "0.1.8"} ; tailwind css classes
99
;org.pinkgorilla/ui-repl {:mvn/version "0.0.72"}

demo/src/demo/page/quanta.cljs

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
{:type :select :path [2 :trailing-n], :name "trailing#", :spec [2 5 10 20 30 50 80 100 120 150]}
2020
{:type :select :path [2 :atr-n], :name "dATR#", :spec [5 10 20 30]}
2121
{:type :select :path [2 :percentile], :name "dPercentile", :spec [10 20 30 40 50 60 70 80 90]}
22+
{:type :label :name "v2"}
2223
{:type :select :path [2 :step], :name "dStep", :spec [0.001 1.0E-4 4.0E-5]}
2324
{:type :select :path [4 :max-open-close-over-low-high], :name "doji-co/lh max", :spec [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]}])
2425

@@ -53,4 +54,15 @@
5354
:edit options
5455
:state state}]
5556

57+
58+
[h1 "labels-left-1-col"]
59+
[options-ui2 {:class "bg-blue-300 options-label-left"
60+
:style {:width "300px"
61+
;:height "40vh"
62+
}
63+
:edit options
64+
:state state}]
65+
66+
67+
5668
])

src/options/core.cljs

+17-10
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,23 @@
2525

2626
(defn create-edit-element [{:keys [set-fn get-fn]} {:keys [path name type] :as options}]
2727
(let [editor (get-editor type)]
28-
[:<>
29-
[:span
30-
{:style {:text-overflow "ellipsis"
31-
:overflow "hidden"
32-
:display "inline-block"}}
33-
34-
name] ; <label for= "pet-select" >Choose a pet:</label>
35-
[editor {:set-fn (partial set-fn path)
36-
:options options}
37-
(get-fn path)]]))
28+
(if (= type :label)
29+
; label only
30+
[:<>
31+
[:span]
32+
[:span.font-bold.font-big name]]
33+
; editor
34+
[:<>
35+
[:span
36+
{:style {:text-overflow "clip" ; "ellipsis" ; ellipsis needs too much space, clip allws to display a little more text
37+
:white-space "nowrap" ; nowrap is needed; otherwise text would flow to next line
38+
:overflow "hidden"
39+
:display "inline-block"}}
40+
41+
name] ; <label for= "pet-select" >Choose a pet:</label>
42+
[editor {:set-fn (partial set-fn path)
43+
:options options}
44+
(get-fn path)]])))
3845

3946
(defn options-ui2 [{:keys [class style
4047
edit

0 commit comments

Comments
 (0)