enhance(ux): add an apply button to multiple selects

This commit is contained in:
Tienson Qin
2023-04-04 14:42:18 +08:00
parent b2e6e3d16b
commit a1c3804e96
2 changed files with 15 additions and 10 deletions

View File

@@ -47,7 +47,7 @@
prompt-key input-default-placeholder close-modal?
extract-fn host-opts on-input input-opts
item-cp transform-fn tap-*input-val
multiple-choices? _selected-choices]
multiple-choices? on-apply _selected-choices]
:or {limit 100
prompt-key :select/default-prompt
empty-placeholder (fn [_t] [:div])
@@ -90,7 +90,10 @@
(when close-modal? (state/close-modal!))
(when on-chosen
(on-chosen (if multiple-choices? @*selected-choices x))))))
:empty-placeholder (empty-placeholder t)})]]))
:empty-placeholder (empty-placeholder t)})]
(when multiple-choices?
[:div.p-4 (ui/button "Apply updates" :on-click on-apply)])]))
(defn select-config
"Config that supports multiple types (uses) of this component. To add a new