             [uxbox.data.lightbox :as udl]
             [uxbox.ui.mixins :as mx]
             [uxbox.ui.keyboard :as k]
+            [uxbox.util.dom :as dom]
             [goog.events :as events])
   (:import goog.events.EventType))
 

(defmethod render-lightbox :default [_] nil)

(defn- on-esc-clicked
  [e]
  (when (k/esc? e)
    (udl/close!)))

(defn- lightbox-will-mount
  [own]

  (let [data (rum/react lightbox-l)]
    (html
     [:div.lightbox
      {:class (when (nil? data) "hide")
       :ref "parent"
       :on-click (partial on-out-clicked own)}
      (render-lightbox data)])))

(def lightbox
