Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn search-dish
- []
- (let [search-query (re-frame/subscribe [::subs/search-query])]
- (fn []
- [:div.search-dish-form
- [:input.search-dish {:type "text"
- ;:auto-focus true
- :value @search-query
- :on-change #(re-frame/dispatch [::events/set-search-query (-> % .-target .-value)])}]
- [:button.clear-search
- {:on-click #(re-frame/dispatch [::events/set-search-query ""])}
- [re-com/md-icon-button :md-icon-name "zmdi-close"]]])))
- (defn menu-view
- []
- (let [filtered-dishes (re-frame/subscribe [::subs/filtered-dishes])]
- (fn []
- [:div.menu-wrapper
- [search-dish]
- [:div.menu-list
- (for [dish @filtered-dishes]
- ^{:key (:id dish)} [:div.menu-dish-buttons-wrapper
- [:button {:on-click #(re-frame/dispatch [::events/add-new-dish dish true])
- :class "list-group-item product-button list-button"}
- (:short_name dish)]
- [:button.edit-menu-dish
- {:on-click #(re-frame/dispatch [::events/add-new-dish dish false])}
- [re-com/md-icon-button :md-icon-name "zmdi-edit"]]])]])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement