cljss icon indicating copy to clipboard operation
cljss copied to clipboard

Rum issues

Open aliaksandr-s opened this issue 5 years ago • 1 comments
trafficstars

Using :css inside conditionals in rum components won't compile properly.

Here is an example of a component:

(rum/defcs a-comp < (rum/local false ::selected?)
  [state]
  (let [local-selected? (::selected? state)]
    [:div 
     (if @local-selected?
       [:div
        {:css {:color "red"}}]
       [:div
        {:css {:color "green"}}])]))

And html produced by it:

<div>
  <div css="[object Object]"></div>
</div>

aliaksandr-s avatar Mar 22 '20 18:03 aliaksandr-s

I think im seeing the same issue, though shadow doesn't even seem to produce a build when you try this. The commented outversion that doesn't use merge works, the other does work. It seems to expect a hashmap only.

(rum/defc plant-stage-v2
  [{:keys [grid-column-start grid-column-end grid-row-start grid-row-end] :as m}]
  [:div {:css (merge m {:background-color                  :inherit
                        :border                            0
                        #_#_#_#_#_#_#_#_:grid-column-start grid-column-start
                        :grid-column-end                   grid-column-end
                        :grid-row-start                    grid-row-end
                        :grid-row-end                      grid-row-end

                        })}
   [:img {:css {:width         "100%"
                :height        "100%"
                :object-fit    "cover"
                #_#_:animation plusing-pink-glow
                :border-radius "50%"}
          :src "img/rose.png"}]])

drewverlee avatar Jul 21 '21 23:07 drewverlee