 (ns web.components.node-link
   (:require [om.next :as om :refer-macros [defui]]
-            [om.dom :as dom]))
+            [om.dom :as dom]
+            [web.routing :as routing]))
 
 (defui Badge
   Object


(def badge (om/factory Badge))

(defui NodeLink
  static om/Ident
  (ident [this props]

    [:name :title :kind])
  Object
  (render [this]
    (let [{:keys [name title kind]} (om/props this)
          route (node->route (om/props this))]
      (dom/a #js {:onClick #(routing/activate-route! route)
                  :className "node-link"}
        (badge {:kind kind})
        (dom/span #js {:className "node-link-title"} title)
        (dom/span #js {:className "node-link-name"} name)))))
