UI improvements.
This commit is contained in:
@@ -25,21 +25,27 @@
|
||||
(let [{:keys [visible? saving?]} @(re-frame/subscribe [::subs/modal-state id])]
|
||||
(when visible?
|
||||
(-> [modal {:title title
|
||||
:foot [:button.button.is-primary {:on-click (fn []
|
||||
(re-frame/dispatch [::events/modal-status id {:saving? true}])
|
||||
(re-frame/dispatch save-event))
|
||||
:disabled (cond saving?
|
||||
"disabled"
|
||||
:foot [:input.button.is-primary {
|
||||
:type "submit"
|
||||
:form id
|
||||
:disabled (cond saving?
|
||||
"disabled"
|
||||
|
||||
(not can-submit?)
|
||||
"disabled"
|
||||
(not can-submit?)
|
||||
"disabled"
|
||||
|
||||
:else
|
||||
"")
|
||||
:class (when saving?
|
||||
"is-loading")}
|
||||
[:span action-text]]
|
||||
:else
|
||||
"")
|
||||
:class (when saving?
|
||||
"is-loading")
|
||||
:value action-text}
|
||||
]
|
||||
:id id
|
||||
:hide-event [::events/modal-status id {:visible? false}]}]
|
||||
(into (r/children (r/current-component)) )
|
||||
:hide-event [::events/modal-status id {:visible? false}]}
|
||||
(into [:form {:id id
|
||||
:on-submit (fn [e]
|
||||
(.preventDefault e)
|
||||
(re-frame/dispatch [::events/modal-status id {:saving? true}])
|
||||
(re-frame/dispatch save-event))}]
|
||||
(r/children (r/current-component)) )]
|
||||
(into [(when saving? [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])])))))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[clojure.string :as str]))
|
||||
|
||||
(defn typeahead [{:keys [matches on-change field text-field value class not-found-description
|
||||
not-found-value]}]
|
||||
not-found-value auto-focus]}]
|
||||
(let [text (r/atom (or (second (first (filter #(= (first %) value) matches))) ""))
|
||||
highlighted (r/atom 0)
|
||||
selected (r/atom (first (first (filter #(= (first %) value) matches))))
|
||||
@@ -34,6 +34,7 @@
|
||||
:class class
|
||||
:field field
|
||||
:value @text
|
||||
:auto-focus auto-focus
|
||||
:on-blur (fn [e]
|
||||
(cond @selected
|
||||
nil
|
||||
|
||||
Reference in New Issue
Block a user