Advertisement
dredder

re-frame animation

May 16th, 2018
2,782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (re-frame/reg-event-db
  2.   ::set-slide-window
  3.   [re-frame/trim-v]
  4.   (fn [db [show? template]]
  5.     (assoc db :slide-template {:show? show?
  6.                                :template template})))
  7.  
  8. (defn slide-panel
  9.   []
  10.   (let [left-position-template (re-frame/subscribe [::subs/left-position-slide-panel])
  11.         menu-panel-width (re-frame/subscribe [::subs/menu-panel-width])
  12.         slide-panel-template (re-frame/subscribe [::subs/slide-panel-template])]
  13.     (fn []
  14.       [:div#menu-backdrop
  15.        {:style {:left @left-position-template}
  16.         :on-click #(if (= (.-currentTarget %) (.-target %))
  17.                      (re-frame/dispatch [::common-events/set-slide-window false nil])
  18.                      false)}
  19.        [:div#slide-panel
  20.         {:style {:left @left-position-template
  21.                  :width @menu-panel-width}}
  22.         (case @slide-panel-template
  23.           :menu [menu-view/menu-view]
  24.           :dish [dish/dish]
  25.           [:h1 "Нет шаблона"])]])))
  26.  
  27. (defn new-sale-receipt
  28.   []
  29.     ...
  30.     [:button.add-dish
  31.                  {:on-click #(re-frame/dispatch [::common-events/set-slide-window true :menu])} ; <-- Invoke slide-meny animation                
  32.                  "Б+"]
  33.     ...)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement