makes it look like you can add a new invoice.

This commit is contained in:
Bryce Covert
2018-05-22 22:30:54 -07:00
parent 6bb4c6e928
commit 37371024d1
4 changed files with 102 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
(ns auto-ap.views.components.modal
(:require [re-frame.core :as re-frame]
[reagent.core :as r]
[auto-ap.events :as events]
[auto-ap.subs :as subs]
[auto-ap.views.utils :refer [with-keys]]))
@@ -13,8 +14,8 @@
[:p.modal-card-title
title]
[:button.delete {:on-click (fn [] (re-frame/dispatch hide-event))}]]
[:section.modal-card-body
(with-keys body)]
(into [:section.modal-card-body]
(r/children (r/current-component)))
(when foot
[:footer.modal-card-foot
@@ -23,16 +24,14 @@
(defn action-modal [{:keys [title action-text id save-event]} & rest]
(let [{:keys [visible? saving?]} @(re-frame/subscribe [::subs/modal-state id])]
(when visible?
[modal {:title title
:foot [:a.button.is-primary {:on-click (fn []
(re-frame/dispatch [::events/modal-status id {:saving? true}])
(re-frame/dispatch save-event))
:class (when saving?
"is-loading")}
[:span action-text]]
:id id
:hide-event [::events/modal-status id {:visible? false}]}
(with-keys rest)
(when saving? [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])])))
(-> [modal {:title title
:foot [:a.button.is-primary {:on-click (fn []
(re-frame/dispatch [::events/modal-status id {:saving? true}])
(re-frame/dispatch save-event))
:class (when saving?
"is-loading")}
[:span action-text]]
:id id
:hide-event [::events/modal-status id {:visible? false}]}]
(into (r/children (r/current-component)) )
(into [(when saving? [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])])))))