         :placeholder placeholder
         :on-blur save
         :on-change #(reset! val (-> % .-target .-value))
-        :on-key-down #(case (.-which %)
-                        13 (save)
-                        27 (stop)
-                        nil)}])))
+        :on-key-down #(cond
+                        (= (.-which %) KEY_ENTER) (save)
+                        (= (.-which %) KEY_ESCAPE) (stop)
+                        :else nil)}])))
+
+(defn todo-header [title placeholder]
+  [:header.header
+   [:h1 title]
+   [todo-input {:class "new-todo" :placeholder placeholder
+                :on-save add-todo}]])
 
 (defn todo-item []
   (let [editing (r/atom false)]

(ns todomvc-reagent.core
  (:require [reagent.core :as r]
            [clojure.string :as s]))

;; -------------------------
;; Db

           active-cnt (- (count items) completed-cnt)]
      [:div
       [:section.todoapp
        [todo-header "reagent" "What needs to be done?"]

        (when (pos? (count items))
          [:div
