Change dropdown component: remove doall, use into instead of conj
This commit is contained in:
parent
a52f5f2b20
commit
9e9d0f6d4d
|
@ -15,21 +15,21 @@
|
|||
"If val-ratom is set, preselect it in the dropdown.
|
||||
Add value of val-ratom if it's missing from items list.
|
||||
Otherwise, prepend title as a disabled option"
|
||||
(let [items (cond-> items
|
||||
(let [items (cond->> items
|
||||
(and @val-ratom
|
||||
(not (contains? (set items) @val-ratom)))
|
||||
(conj @val-ratom)
|
||||
(into [@val-ratom])
|
||||
(not @val-ratom)
|
||||
(conj title))]
|
||||
(into [title]))]
|
||||
(fn []
|
||||
[:select.ui.basic.selection.dropdown
|
||||
(merge props {:on-change
|
||||
#(reset! val-ratom (-> % .-target .-value))
|
||||
:default-value (or @val-ratom title)})
|
||||
(doall (for [item items]
|
||||
(for [item items]
|
||||
^{:key item} [:option {:value item
|
||||
:disabled (= item title)}
|
||||
item]))])))
|
||||
item])])))
|
||||
|
||||
(defn moment-timestamp [time]
|
||||
(let [now (.now js/Date.)
|
||||
|
|
Loading…
Reference in New Issue