Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn todo-app [& props]
- (let [filt (r/atom :all)]
- (init)
- (fn []
- (let [items (vals @todos)
- done (->> items (filter :done) count)
- active (- (count items) done)]
- [:div
- [:div.form-group
- {:style {:margin-top "20px"}}
- [:button.btn.btn-default
- ; { :type "button" :on-click do-logout}
- { :type "button" :on-click #(do-logout)}
- [:b "Выйти"]]]
- ;
- [:section#todoapp
- [:header#header
- [:h1 "todos"]
- [todo-input {:id "new-todo"
- :placeholder "What needs to be done?"
- :on-save add-todo}]]
- (when (-> items count pos?)
- [:div
- [:section#main
- [:input#toggle-all {:type "checkbox" :checked (zero? active)
- :on-change #(complete-all (pos? active))}]
- [:label {:for "toggle-all"} "Mark all as complete"]
- [:ul#todo-list
- (for [todo (filter (case @filt
- :active (complement :done)
- :done :done
- :all identity) items)]
- ^{:key (:id todo)} [todo-item todo])]]
- [:footer#footer
- [todo-stats {:active active :done done :filt filt}]]])]
- [:footer#info
- [:p "Double-click to edit a todo"]]
- ;
- ]))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement