       :component-function (fn [state]
                             [:div {:id :map-canvas
                                    :style {:height "100%"
-                                           :margin 0
-                                           :padding 0}}
+                                           :width "100%"}}
                              (doall
                               (for [{id :route/id
                                      :as route-data} (:routes @state)]

                                      :strokeOpacity 1.0
                                      :strokeWeight 2}))))

(defn r-map-object [class opts gmap]
  (let [obj (class. (clj->js @opts))]
    (r/create-class
     {:component-did-mount (fn [this]
                             (let [[_ _ opts gmap] (r/argv this)
                                   m-opts (merge @opts {:map gmap})]
                               (.setOptions obj (clj->js m-opts))))
      :component-did-update (fn [this]
                              (let [[_ _ opts gmap] (r/argv this)
                                    m-opts (merge @opts {:map gmap})]
                                (.setOptions obj (clj->js m-opts))))
      :component-will-unmount (fn [this]
                                (.setMap obj nil))
      :component-function (fn [class opts gmap]
                            [:noscript])})))

(defn r-marker [opts gmap]
  (let [marker (Maps.Marker. (clj->js @opts))]
    (r/create-class
     {:component-did-mount (fn [this]
                             (let [[_ opts gmap] (r/argv this)
                                   m-opts (merge @opts {:map gmap})]
                               (.setOptions marker (clj->js m-opts))))
      :component-did-update (fn [this]
                              (let [[_ opts gmap] (r/argv this)
                                    m-opts (merge @opts {:map gmap})]
                                (.setOptions marker (clj->js m-opts))))
      :component-will-unmount (fn [this]
                                (.setMap marker nil))
      :component-function (fn [opts gmap]
                            [:noscript])})))

(defn r-polyline [opts gmap]
  (let [polyline (Maps.Polyline. (clj->js @opts))]
    (r/create-class
     {:component-function (fn [opts gmap]
                            [:noscript])})))

(defn map-listen
  "Return a channel listening on events of type in obj."

                                 (put! out (if e e :msg)))))
    out))

(declare route trip stop-time stop)
(defn route [route gmap]
  (let [{trips :route/trips} route]
    (for [{id :trip/id :as trip-data} trips]
      ^{:key id}
      [trip trip-data gmap])))
#_ (letfn [(reset-fn [state ks id-fn id data]
             (swap! state assoc-in ks
                    (map (if (= (id-fn %) id)
                           data %)
                         (get-in state ks))))]
     [trip (r/wrap trip-data reset-fn id) gmap])

(defn trip [trip gmap]
  (let [stop-times (->> trip
                        :trip/stops
                        (sort-by :stop-time/stop-sequence))
        stops (map :stop-time/stop stop-times)
